├── .github └── workflows │ ├── omuse-ci.yml │ └── templates │ ├── deps-omuse-iemic │ ├── matrix │ ├── pkg-install │ ├── pkg-preamble │ └── preamble ├── .gitignore ├── .readthedocs.yaml ├── LICENSE ├── MANIFEST.in ├── NOTICE ├── README.md ├── Singularity ├── doc ├── Makefile ├── asynchronous.rst ├── conf.py ├── dales ├── era5 ├── index.rst ├── installing.rst ├── requirements.txt ├── singularity.rst ├── tutorial │ ├── 00-OMUSE_Welcome.ipynb │ ├── 01-OMUSE_and_AMUSE.ipynb │ ├── 02-Quantities_with_units.ipynb │ ├── 03-Grids.ipynb │ ├── 04-Codes.ipynb │ ├── 05-Channels.ipynb │ └── amuserc └── units.rst ├── examples ├── README.md └── bubble-notebook.ipynb ├── generate_ci.sh ├── omuse_logo.png ├── packages ├── community_package_names ├── generate_packages.sh ├── generate_setupfiles.sh ├── omuse-era5 │ ├── MANIFEST.in │ ├── README.md │ ├── pyproject.toml │ ├── setup.py │ ├── src │ │ └── omuse │ │ │ └── community │ │ │ └── era5 │ └── support ├── omuse-framework │ ├── MANIFEST.in │ ├── README.md │ ├── pyproject.toml │ ├── setup.py │ ├── src │ │ └── omuse │ └── support ├── omuse-iemic │ ├── MANIFEST.in │ ├── README.md │ ├── pyproject.toml │ ├── setup.py │ ├── src │ │ └── omuse │ │ │ └── community │ │ │ └── iemic │ └── support ├── omuse-qgmodel │ ├── MANIFEST.in │ ├── README.md │ ├── pyproject.toml │ ├── setup.py │ ├── src │ │ └── omuse │ │ │ └── community │ │ │ └── qgmodel │ └── support ├── omuse-swan │ ├── MANIFEST.in │ ├── README.md │ ├── pyproject.toml │ ├── setup.py │ ├── src │ │ └── omuse │ │ │ └── community │ │ │ └── swan │ └── support ├── omuse │ ├── MANIFEST.in │ ├── README.md │ ├── pyproject.toml │ ├── setup.py │ └── support ├── pyproject_template.py └── setup_template.py ├── pyproject.toml ├── setup.py ├── src └── omuse │ ├── __init__.py │ ├── community │ ├── __init__.py │ ├── adcirc │ │ ├── Makefile │ │ ├── __init__.py │ │ ├── adcirc │ │ │ └── readme.txt │ │ ├── data │ │ │ └── test │ │ │ │ ├── 2d │ │ │ │ ├── fort.14 │ │ │ │ └── fort.15 │ │ │ │ └── 3d │ │ │ │ ├── fort.14 │ │ │ │ └── fort.15 │ │ ├── interface.f90 │ │ ├── interface.py │ │ ├── read_grid.py │ │ ├── src │ │ ├── src_v51 │ │ │ ├── adcirc.patch │ │ │ ├── amuse_adcirc.F90 │ │ │ ├── makefile.patch │ │ │ └── makefile_prep │ │ ├── src_v52 │ │ │ ├── adcirc.patch │ │ │ ├── amuse_adcirc.F90 │ │ │ ├── makefile.patch │ │ │ └── makefile_prep │ │ ├── test_adcirc.py │ │ ├── test_adcirc_restart.py │ │ └── write_grid.py │ ├── cdo │ │ ├── Makefile │ │ ├── __init__.py │ │ ├── adcirc_grid_converter.py │ │ ├── cdo-current.tar.gz │ │ ├── grids │ │ │ ├── POP43.nc │ │ │ ├── T42.nc │ │ │ ├── dipole-grid-320x384.nc │ │ │ ├── dst_grid.nc │ │ │ ├── nc_inundation_v6c.grd │ │ │ ├── nc_inundation_v6c.nc │ │ │ └── src_grid.nc │ │ ├── interface.c │ │ ├── interface.py │ │ ├── make_patches.py │ │ ├── patches │ │ │ ├── EOFs.c.patch │ │ │ ├── Makefile.patch │ │ │ ├── remap_conserv_scrip.c.patch │ │ │ └── remap_scrip_io.c.patch │ │ ├── pop_grid_converter.py │ │ ├── script.ar │ │ ├── spherical_geometry.py │ │ ├── test │ │ │ ├── test_CDOInterface.py │ │ │ └── test_CDORemapper.py │ │ ├── view_adcirc_grid.py │ │ ├── view_grid.py │ │ ├── view_weights.py │ │ └── weights │ │ │ └── src_dst_con.nc │ ├── dales │ │ ├── Makefile │ │ ├── README │ │ ├── __init__.py │ │ ├── dalesreader.py │ │ ├── doc │ │ │ └── dales.rst │ │ ├── example │ │ │ ├── async.py │ │ │ ├── bubble.py │ │ │ ├── plot_cross.py │ │ │ └── plot_profs.py │ │ ├── interface.f90 │ │ ├── interface.py │ │ ├── parameters.py │ │ └── test │ │ │ ├── README.md │ │ │ ├── run_dales.f90 │ │ │ └── test_dales.py │ ├── era5 │ │ ├── __init__.py │ │ ├── doc │ │ │ └── era5.rst │ │ ├── era5.py │ │ ├── example.py │ │ ├── interface.py │ │ └── test_era5.py │ ├── iemic │ │ ├── Makefile │ │ ├── __init__.py │ │ ├── implicit_utils.py │ │ ├── interface.cc │ │ ├── interface.hpp │ │ ├── interface.py │ │ ├── mkmask │ │ │ ├── mask_natl8 │ │ │ └── mask_test │ │ ├── ocean_preconditioner_params.xml │ │ ├── paramset.cc │ │ ├── paramset.hpp │ │ ├── remotestatevector.py │ │ ├── setup.cfg │ │ ├── test_iemic.py │ │ └── test_state.py │ ├── oifs │ │ ├── Makefile │ │ ├── Makefile.lisa │ │ ├── README │ │ ├── __init__.py │ │ ├── examples │ │ │ ├── ICMGGTESTINIT │ │ │ ├── ICMGGTESTINIUA │ │ │ ├── ICMSHTESTINIT │ │ │ ├── example1D.py │ │ │ ├── example2D.py │ │ │ ├── fort.4 │ │ │ └── ifsdata │ │ │ │ ├── C11CLIM │ │ │ │ ├── C12CLIM │ │ │ │ ├── C22CLIM │ │ │ │ ├── CCL4CLIM │ │ │ │ ├── CH4CLIM │ │ │ │ ├── CO2CLIM │ │ │ │ ├── ECOZC │ │ │ │ ├── GCH4CLIM │ │ │ │ ├── GCO2CLIM │ │ │ │ ├── GOZOCLIM │ │ │ │ ├── MCICA │ │ │ │ ├── N2OCLIM │ │ │ │ ├── NO2CLIM │ │ │ │ ├── OZOCLIM │ │ │ │ ├── RADRRTM │ │ │ │ ├── RADSRTM │ │ │ │ ├── SO4_A1B2000 │ │ │ │ ├── SO4_A1B2010 │ │ │ │ ├── SO4_A1B2020 │ │ │ │ ├── SO4_A1B2030 │ │ │ │ ├── SO4_A1B2040 │ │ │ │ ├── SO4_A1B2050 │ │ │ │ ├── SO4_A1B2060 │ │ │ │ ├── SO4_A1B2070 │ │ │ │ ├── SO4_A1B2080 │ │ │ │ ├── SO4_A1B2090 │ │ │ │ ├── SO4_A1B2100 │ │ │ │ ├── SO4_OBS1920 │ │ │ │ ├── SO4_OBS1930 │ │ │ │ ├── SO4_OBS1940 │ │ │ │ ├── SO4_OBS1950 │ │ │ │ ├── SO4_OBS1960 │ │ │ │ ├── SO4_OBS1970 │ │ │ │ ├── SO4_OBS1980 │ │ │ │ └── SO4_OBS1990 │ │ ├── interface.f90 │ │ ├── interface.py │ │ └── test │ │ │ ├── ICMGGTESTINIT │ │ │ ├── ICMGGTESTINIUA │ │ │ ├── ICMSHTESTINIT │ │ │ ├── fort.4 │ │ │ ├── ifsdata │ │ │ ├── C11CLIM │ │ │ ├── C12CLIM │ │ │ ├── C22CLIM │ │ │ ├── CCL4CLIM │ │ │ ├── CH4CLIM │ │ │ ├── CO2CLIM │ │ │ ├── ECOZC │ │ │ ├── GCH4CLIM │ │ │ ├── GCO2CLIM │ │ │ ├── GOZOCLIM │ │ │ ├── MCICA │ │ │ ├── N2OCLIM │ │ │ ├── NO2CLIM │ │ │ ├── OZOCLIM │ │ │ ├── RADRRTM │ │ │ ├── RADSRTM │ │ │ ├── SO4_A1B2000 │ │ │ ├── SO4_A1B2010 │ │ │ ├── SO4_A1B2020 │ │ │ ├── SO4_A1B2030 │ │ │ ├── SO4_A1B2040 │ │ │ ├── SO4_A1B2050 │ │ │ ├── SO4_A1B2060 │ │ │ ├── SO4_A1B2070 │ │ │ ├── SO4_A1B2080 │ │ │ ├── SO4_A1B2090 │ │ │ ├── SO4_A1B2100 │ │ │ ├── SO4_OBS1920 │ │ │ ├── SO4_OBS1930 │ │ │ ├── SO4_OBS1940 │ │ │ ├── SO4_OBS1950 │ │ │ ├── SO4_OBS1960 │ │ │ ├── SO4_OBS1970 │ │ │ ├── SO4_OBS1980 │ │ │ └── SO4_OBS1990 │ │ │ └── test_oifs.py │ ├── pop │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── __init__.py │ │ ├── _src_template │ │ │ ├── GNUmakefile │ │ │ ├── POP_DomainSizeMod.py │ │ │ └── domain_size.F90 │ │ ├── dist-60x60-56-16 │ │ ├── interface.f90 │ │ ├── interface.py │ │ ├── pop_in │ │ ├── pop_in_highres │ │ ├── pop_in_lowres │ │ ├── read_grid.py │ │ ├── run_pop.py │ │ ├── run_pop_cartesius.py │ │ ├── run_pop_cartesius_highres.py │ │ ├── run_pop_das5.py │ │ ├── run_pop_das5_eddy_tracking.py │ │ ├── sample_history_contents │ │ ├── sample_movie_contents │ │ ├── sample_tavg_contents │ │ ├── src_120x162x12 │ │ │ └── .gitignore │ │ ├── src_120x56x12 │ │ │ ├── .gitignore │ │ │ ├── GNUmakefile │ │ │ ├── POP_DomainSizeMod.F90 │ │ │ └── domain_size.F90 │ │ ├── src_192x160x12 │ │ │ └── .gitignore │ │ ├── src_240x110x12 │ │ │ ├── .gitignore │ │ │ ├── GNUmakefile │ │ │ ├── POP_DomainSizeMod.F90 │ │ │ └── domain_size.F90 │ │ ├── src_240x162x12 │ │ │ └── .gitignore │ │ ├── src_240x216x24 │ │ │ └── .gitignore │ │ ├── src_320x384x40 │ │ │ ├── GNUmakefile │ │ │ ├── POP_DomainSizeMod.F90 │ │ │ └── domain_size.F90 │ │ ├── src_3600x2400x42 │ │ │ ├── GNUmakefile │ │ │ ├── POP_DomainSizeMod.F90 │ │ │ └── domain_size.F90 │ │ ├── src_96x120x12 │ │ │ ├── GNUmakefile │ │ │ ├── POP_DomainSizeMod.F90 │ │ │ └── domain_size.F90 │ │ ├── src_96x40x12 │ │ │ ├── GNUmakefile │ │ │ ├── POP_DomainSizeMod.F90 │ │ │ └── domain_size.F90 │ │ ├── start_pop.py │ │ ├── tavg_contents │ │ ├── test │ │ │ ├── test_POP.py │ │ │ └── test_POPInterface.py │ │ ├── transport_contents │ │ └── transport_file_highres │ ├── qgcm │ │ ├── Makefile │ │ ├── __init__.py │ │ ├── default_param.f90 │ │ ├── fortran_tools.py │ │ ├── hogg2006.config │ │ ├── hogg2006_20km.config │ │ ├── hogg2006_20km_parameters_data.F │ │ ├── hogg2006_parameters_data.F │ │ ├── interface.f90 │ │ ├── interface.py │ │ ├── make.macro │ │ ├── ocean_only.config │ │ ├── ocean_only_parameters_data.F │ │ ├── src │ │ │ ├── omuse_q-gcm.F │ │ │ ├── omuse_valsubs.F │ │ │ ├── q-gcm_utility.F │ │ │ └── qocdiag.F │ │ └── test_qgcm.py │ ├── qgmodel │ │ ├── Makefile │ │ ├── __init__.py │ │ ├── dijkstra2005.py │ │ ├── interface.f90 │ │ ├── interface.py │ │ ├── plot_wind.py │ │ ├── run_qgmodel.py │ │ ├── src │ │ │ ├── Makefile │ │ │ ├── beta.f90 │ │ │ ├── chi.f90 │ │ │ ├── d_Poisson_2D_f.f90 │ │ │ ├── d_Poisson_2D_f_fishpack.f90 │ │ │ ├── fishpack4.1 │ │ │ │ ├── Makefile │ │ │ │ ├── doc │ │ │ │ │ ├── FISH.gif │ │ │ │ │ ├── FISHPACK.html │ │ │ │ │ └── README_FISHPACK4.1 │ │ │ │ ├── output │ │ │ │ │ ├── darwin.dp │ │ │ │ │ └── darwin.sp │ │ │ │ ├── src │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── blktri.f │ │ │ │ │ ├── cblktri.f │ │ │ │ │ ├── cmgnbn.f │ │ │ │ │ ├── comf.f │ │ │ │ │ ├── fftpack.f │ │ │ │ │ ├── genbun.f │ │ │ │ │ ├── gnbnaux.f │ │ │ │ │ ├── hstcrt.f │ │ │ │ │ ├── hstcsp.f │ │ │ │ │ ├── hstcyl.f │ │ │ │ │ ├── hstplr.f │ │ │ │ │ ├── hstssp.f │ │ │ │ │ ├── hw3crt.f │ │ │ │ │ ├── hwscrt.f │ │ │ │ │ ├── hwscsp.f │ │ │ │ │ ├── hwscyl.f │ │ │ │ │ ├── hwsplr.f │ │ │ │ │ ├── hwsssp.f │ │ │ │ │ ├── pois3d.f │ │ │ │ │ ├── poistg.f │ │ │ │ │ ├── sepaux.f │ │ │ │ │ ├── sepeli.f │ │ │ │ │ └── sepx4.f │ │ │ │ └── test │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── tblktri.f │ │ │ │ │ ├── tcblktri.f │ │ │ │ │ ├── tcmgnbn.f │ │ │ │ │ ├── tgenbun.f │ │ │ │ │ ├── thstcrt.f │ │ │ │ │ ├── thstcsp.f │ │ │ │ │ ├── thstcyl.f │ │ │ │ │ ├── thstplr.f │ │ │ │ │ ├── thstssp.f │ │ │ │ │ ├── thw3crt.f │ │ │ │ │ ├── thwscrt.f │ │ │ │ │ ├── thwscsp.f │ │ │ │ │ ├── thwscyl.f │ │ │ │ │ ├── thwsplr.f │ │ │ │ │ ├── thwsssp.f │ │ │ │ │ ├── tpois3d.f │ │ │ │ │ ├── tpoistg.f │ │ │ │ │ ├── tsepeli.f │ │ │ │ │ └── tsepx4.f │ │ │ ├── include │ │ │ │ ├── Makefile │ │ │ │ ├── mkl_dfti.f90 │ │ │ │ ├── mkl_dfti.h │ │ │ │ ├── mkl_poisson.f90 │ │ │ │ └── mkl_poisson.h │ │ │ ├── jacobian.f90 │ │ │ ├── main.f90 │ │ │ ├── vis_bot.f90 │ │ │ ├── vis_lat.f90 │ │ │ └── wind.f90 │ │ ├── test_bc.py │ │ ├── test_qgmodel.py │ │ └── viebahn2014.py │ └── swan │ │ ├── Makefile │ │ ├── __init__.py │ │ ├── interface.f90 │ │ ├── interface.py │ │ ├── src │ │ ├── Makefile │ │ ├── amuse_swan.ftn90 │ │ ├── macros.inc │ │ ├── swan.patch │ │ └── swan │ │ │ ├── HottifySWAN.ftn90 │ │ │ ├── INSTALL.README │ │ │ ├── Makefile │ │ │ ├── SWANRUN.README │ │ │ ├── SwanBndStruc.ftn90 │ │ │ ├── SwanBpntlist.ftn90 │ │ │ ├── SwanCheckGrid.ftn90 │ │ │ ├── SwanCompUnstruc.ftn90 │ │ │ ├── SwanCompdata.ftn90 │ │ │ ├── SwanComputeForce.ftn90 │ │ │ ├── SwanConvAccur.ftn90 │ │ │ ├── SwanConvStopc.ftn90 │ │ │ ├── SwanCreateEdges.ftn90 │ │ │ ├── SwanCrossObstacle.ftn90 │ │ │ ├── SwanDiffPar.ftn90 │ │ │ ├── SwanDispParm.ftn90 │ │ │ ├── SwanFindObstacles.ftn90 │ │ │ ├── SwanFindPoint.ftn90 │ │ │ ├── SwanGSECorr.ftn90 │ │ │ ├── SwanGridCell.ftn90 │ │ │ ├── SwanGridFace.ftn90 │ │ │ ├── SwanGridTopology.ftn90 │ │ │ ├── SwanGridVert.ftn90 │ │ │ ├── SwanGriddata.ftn90 │ │ │ ├── SwanGridobjects.ftn90 │ │ │ ├── SwanInitCompGrid.ftn90 │ │ │ ├── SwanInterpolateAc.ftn90 │ │ │ ├── SwanInterpolateOutput.ftn90 │ │ │ ├── SwanInterpolatePoint.ftn90 │ │ │ ├── SwanIntgratSpc.ftn90 │ │ │ ├── SwanMaxOverNodes.ftn90 │ │ │ ├── SwanMinOverNodes.ftn90 │ │ │ ├── SwanPointinMesh.ftn90 │ │ │ ├── SwanPrepComp.ftn90 │ │ │ ├── SwanPrintGridInfo.ftn90 │ │ │ ├── SwanPropvelS.ftn90 │ │ │ ├── SwanPropvelX.ftn90 │ │ │ ├── SwanPunCollect.ftn90 │ │ │ ├── SwanReadADCGrid.ftn90 │ │ │ ├── SwanReadEasymeshGrid.ftn90 │ │ │ ├── SwanReadGrid.ftn90 │ │ │ ├── SwanReadTriangleGrid.ftn90 │ │ │ ├── SwanReadfort18.ftn90 │ │ │ ├── SwanSumOverNodes.ftn90 │ │ │ ├── SwanSweepSel.ftn90 │ │ │ ├── SwanThreadBounds.ftn90 │ │ │ ├── SwanTranspAc.ftn90 │ │ │ ├── SwanTranspX.ftn90 │ │ │ ├── SwanVertlist.ftn90 │ │ │ ├── agioncmd.ftn90 │ │ │ ├── couple2adcirc.ftn90 │ │ │ ├── hcat.nml │ │ │ ├── m_constants.ftn90 │ │ │ ├── m_fileio.ftn90 │ │ │ ├── machinefile │ │ │ ├── macros.inc │ │ │ ├── mod_xnl4v5.ftn90 │ │ │ ├── nctablemd.ftn90 │ │ │ ├── ocpcre.ftn │ │ │ ├── ocpids.ftn │ │ │ ├── ocpmix.ftn │ │ │ ├── platform.pl │ │ │ ├── plotgrid.m │ │ │ ├── plotunswan.m │ │ │ ├── serv_xnl4v5.ftn90 │ │ │ ├── swan.edt │ │ │ ├── swancom1.ftn │ │ │ ├── swancom2.ftn │ │ │ ├── swancom3.ftn │ │ │ ├── swancom4.ftn │ │ │ ├── swancom5.ftn │ │ │ ├── swanhcat.ftn │ │ │ ├── swanmain.ftn │ │ │ ├── swanout1.ftn │ │ │ ├── swanout2.ftn │ │ │ ├── swanparll.ftn │ │ │ ├── swanpre1.ftn │ │ │ ├── swanpre2.ftn │ │ │ ├── swanrun │ │ │ ├── swanrun.bat │ │ │ ├── swanser.ftn │ │ │ ├── switch.pl │ │ │ ├── swmod1.ftn │ │ │ ├── swmod2.ftn │ │ │ ├── swn_outnc.ftn90 │ │ │ └── which.cmd │ │ ├── swaninit │ │ └── test │ │ ├── f31har01.bnd │ │ ├── f31har01.swn │ │ ├── f31hari.bot │ │ ├── f32hari.ele │ │ ├── f32hari.node │ │ ├── plot_data.py │ │ ├── read_triangle_mesh.py │ │ ├── swaninit │ │ ├── test_haringvliet.py │ │ ├── test_haringvliet_unstructured.py │ │ └── test_swan.py │ ├── ext │ ├── __init__.py │ ├── _seawater │ │ ├── README │ │ ├── __init__.py │ │ ├── density.py │ │ ├── heat.py │ │ ├── misc.py │ │ ├── salinity.py │ │ └── test.py │ ├── dispersion_relations.py │ ├── eddy_tracker │ │ ├── SSH_t.t0.1_42l_nccs01.avg0315-0325.nc │ │ ├── __init__.py │ │ ├── haversine_distmat_python.py │ │ ├── interface.py │ │ ├── make_eddy_track_AVISO.py │ │ ├── make_eddy_track_ROMS.py │ │ ├── make_eddy_tracker_list_obj.py │ │ ├── py_eddy_tracker_classes.py │ │ ├── py_eddy_tracker_property_classes.py │ │ ├── roms_grid.py │ │ ├── rossrad.dat │ │ └── track_eddy.py │ ├── grid_generators.py │ ├── grid_remappers.py │ ├── hurricane_models.py │ ├── seawater.py │ ├── simple_triangulations.py │ └── spherical_geometry.py │ ├── io │ ├── __init__.py │ ├── adcirc.py │ └── pop_netcdf.py │ └── units │ ├── __init__.py │ ├── constants.py │ ├── quantities.py │ └── units.py ├── support ├── __init__.py ├── classifiers.py └── setup_codes.py └── test └── __init__.py /.github/workflows/templates/deps-omuse-iemic: -------------------------------------------------------------------------------- 1 | - name: Install dependencies (Linux) 2 | if: runner.os == 'Linux' 3 | run: | 4 | sudo apt-get install gfortran libopenblas-dev libhdf5-openmpi-dev libptscotch-dev trilinos-all-dev libslicot-dev 5 | 6 | - name: Install dependencies (MacOS) 7 | if: runner.os == 'macOS' 8 | run: | 9 | brew tap nlesc/nlesc 10 | brew update 11 | brew upgrade 12 | brew install nlesc/nlesc/trilinos nlesc/nlesc/slicot 13 | 14 | -------------------------------------------------------------------------------- /.github/workflows/templates/matrix: -------------------------------------------------------------------------------- 1 | strategy: 2 | matrix: 3 | os: [ macos-latest, ubuntu-latest ] 4 | python: [ 3.8 ] 5 | java: [ 1.8 ] 6 | gfortran: [ gfortran-9, gfortran-10 ] 7 | 8 | -------------------------------------------------------------------------------- /.github/workflows/templates/pkg-install: -------------------------------------------------------------------------------- 1 | - name: "Install OMUSE package: PKG_NAME" 2 | run: | 3 | pip install --no-clean --pre --find-links dist/ PKG_NAME 4 | rm -rf "${TEMP_DIR}"/pip-*/ 5 | env: 6 | TEMP_DIR: ${{ steps.get_temp.outputs.TMPDIR }} 7 | 8 | - name: Archive pip failure output 9 | uses: actions/upload-artifact@v2 10 | if: failure() 11 | with: 12 | name: build-logs 13 | path: ${{ steps.get_temp.outputs.TMPDIR }}/pip-*/ 14 | -------------------------------------------------------------------------------- /.github/workflows/templates/pkg-preamble: -------------------------------------------------------------------------------- 1 | needs: package 2 | 3 | runs-on: ${{ matrix.os }} 4 | 5 | steps: 6 | - uses: actions/download-artifact@v2 7 | with: 8 | name: sdists-${{ needs.package.outputs.version }} 9 | path: dist/ 10 | 11 | - name: Set up JDK 12 | uses: actions/setup-java@v1 13 | with: 14 | java-version: ${{ matrix.java }} 15 | 16 | - name: Set up Python 17 | uses: actions/setup-python@v2 18 | with: 19 | python-version: ${{ matrix.python }} 20 | 21 | - name: Install Python wheel 22 | run: | 23 | pip install --upgrade pip wheel 24 | 25 | - name: Install OMUSE dependencies (Linux) 26 | if: runner.os == 'Linux' 27 | run: | 28 | sudo apt-get install libopenmpi-dev # gfortran libopenblas-dev libhdf5-openmpi-dev libgsl0-dev cmake libfftw3-3 libfftw3-dev libmpfr6 libmpfr-dev libnetcdf-dev libnetcdff-dev 29 | 30 | - name: Install OMUSE dependencies (macOS) 31 | if: runner.os == 'macOS' 32 | run: | 33 | brew install openmpi 34 | echo "OMPI_FC=${FC}" >> $GITHUB_ENV 35 | echo "F77=${FC}" >> $GITHUB_ENV 36 | env: 37 | FC: ${{ matrix.gfortran }} 38 | 39 | - name: Determine temp directory 40 | id: get_temp 41 | run: | 42 | echo "::set-output name=TMPDIR::${TMPDIR:-/tmp/}" 43 | 44 | - name: Compiler cache 45 | uses: hendrikmuhs/ccache-action@v1 46 | with: 47 | key: PKG_NAME-${{ matrix.os }}-${{ matrix.gfortran }} 48 | max-size: 5000M 49 | 50 | - name: Point compilers at ccache 51 | run: | 52 | echo "/usr/lib/ccache" >> $GITHUB_PATH 53 | echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH 54 | echo "AMUSE_USE_CCACHE=1" >> $GITHUB_ENV 55 | echo "CMAKE_C_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV 56 | echo "CMAKE_CXX_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV 57 | echo "CMAKE_Fortran_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV 58 | echo "CCACHE_COMPILERCHECK=content" >> $GITHUB_ENV 59 | echo "CCACHE_NOHASHDIR=true" >> $GITHUB_ENV 60 | 61 | -------------------------------------------------------------------------------- /.github/workflows/templates/preamble: -------------------------------------------------------------------------------- 1 | name: omuse-ci 2 | 3 | on: 4 | push: 5 | branches: [ '*' ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | package: 11 | outputs: 12 | version: ${{ steps.sdists.outputs.VERSION }} 13 | 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v3 18 | with: 19 | # Need to correctly generate version number using setuptools_scm 20 | # See: https://github.com/pypa/setuptools_scm/issues/480 21 | fetch-depth: 0 22 | 23 | - name: Validate CI setup 24 | run: | 25 | ./generate_ci.sh validate.yml 26 | diff -u validate.yml .github/workflows/omuse-ci.yml 27 | 28 | - name: Set up Python 29 | uses: actions/setup-python@v4 30 | with: 31 | python-version: '3.8' 32 | cache: 'pip' 33 | cache-dependency-path: '**/setup.py' 34 | 35 | - name: Install Python dependencies 36 | run: | 37 | python -m pip install --upgrade pip setuptools wheel setuptools_scm 38 | 39 | - name: Install amuse-devel 40 | run: | 41 | git clone https://github.com/amusecode/amuse 42 | cd amuse 43 | pip install -e . 44 | 45 | - name: Build sdists 46 | id: sdists 47 | run: | 48 | cd src/omuse/community/iemic 49 | make download 50 | cd ../../../../packages 51 | ./generate_packages.sh 52 | 53 | cd omuse-framework 54 | echo "::set-output name=VERSION::$(python setup.py --version)" 55 | 56 | - uses: actions/upload-artifact@v2 57 | with: 58 | name: sdists-${{ steps.sdists.outputs.VERSION }} 59 | path: packages/dist/*.tar.gz 60 | 61 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build.log 2 | amuse.cfg 3 | *.o 4 | *.mod 5 | *.pyc 6 | *.a 7 | *.exe 8 | worker_code.f90 9 | src/omuse/community/pop/src_320x384x40/compile/* 10 | src/omuse/community/pop/src_320x384x40/pop 11 | src/omuse/community/pop/src_320x384x40/libpop.a 12 | src/omuse/community/pop/src_3600x2400x42/compile/* 13 | src/omuse/community/pop/src_3600x2400x42/pop 14 | src/omuse/community/pop/src_3600x2400x42/libpop.a 15 | src/omuse/community/pop/pop_worker_* 16 | src/omuse/community/pop/.*\.png$ 17 | src/omuse/community/pop/eSalsa-POP/* 18 | src/omuse/community/pop/old/* 19 | src/omuse/community/pop/data/* 20 | src/omuse/community/pop/slurm-*.out 21 | src/omuse/community/pop/worker_code.f90 22 | src/omuse/community/cdo/grids/tripole-3600x2400.nc 23 | src/omuse/community/cdo/src/* 24 | src/omuse/community/cdo/cdo-1.7.0rc/* 25 | src/omuse/community/cdo/remapper_worker 26 | src/omuse/community/cdo/worker_code.cc 27 | src/omuse/community/cdo/worker_code.h 28 | src/omuse/community/swan/src/work/* 29 | src/omuse/community/swan/worker_code.f90 30 | src/omuse/community/swan/swan_worker 31 | src/omuse/community/swan/getter_setters.f90 32 | src/omuse/community/swan/src/amuse_swan.f90 33 | src/omuse/community/adcirc/fort.* 34 | src/omuse/community/adcirc/adcirc_worker 35 | src/omuse/community/adcirc/worker_code.f90 36 | src/omuse/community/adcirc/adcirc/adcirc* 37 | src/omuse/community/dales/dales-build/* 38 | src/omuse/community/oifs/oifs40r1/* 39 | src/omuse/community/qgcm/build_* 40 | src/omuse/community/qgcm/src/q-gcm/ 41 | src/omuse/community/iemic/src/jdqzpp/ 42 | src/omuse/community/iemic/src/i-emic/ 43 | syntax: glob 44 | src/omuse/ext/eddy_tracker/**.png 45 | src/omuse/community/pop/*.dat 46 | src/omuse/community/dales/dales-repo/* 47 | src/omuse/community/oifs/oifslib/* 48 | src/omuse/community/oifs/oifs-repo/* 49 | src/omuse/community/spifs/* 50 | src/omuse/community/iemic/iemic_worker* 51 | src/omuse/community/iemic/worker_code.* 52 | src/omuse/community/iemic/src/ 53 | .pytest_cache/ 54 | # Default ignored files 55 | src/omuse/community/dales/.idea/workspace.xml 56 | src/omuse.egg-info/ 57 | src/omuse/community/adcirc/src_v51/adcirc_src/ 58 | src/omuse/community/cdo/cdo-1.7.0rc5/ 59 | src/omuse/community/cdo/make_patches.py.bak 60 | src/omuse/community/cdo/src 61 | src/omuse/community/dales/dales-repo/ 62 | src/omuse/community/dales/dales_worker 63 | src/omuse/community/dales/data/ 64 | src/omuse/community/dales/test/run_dales 65 | src/omuse/community/iemic/jdqzpp/ 66 | src/omuse/community/oifs/oifs-repo/ 67 | src/omuse/community/pop/eSalsa-POP/ 68 | src/omuse/community/pop/src_test/compile/ 69 | src/omuse/community/qgcm/getter_setters.f90 70 | src/omuse/community/qgcm/qgcm_worker_hogg2006 71 | src/omuse/community/qgcm/qgcm_worker_hogg2006_20km 72 | src/omuse/community/qgcm/qgcm_worker_ocean_only 73 | src/omuse/community/qgmodel/qgmodel_worker 74 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yaml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | # Set the version of Python and other tools you might need 9 | build: 10 | os: ubuntu-20.04 11 | tools: 12 | python: "3.8" 13 | # You can also specify other tool versions: 14 | # nodejs: "16" 15 | # rust: "1.55" 16 | # golang: "1.17" 17 | apt_packages: 18 | - gfortran 19 | - libgsl-dev 20 | - cmake 21 | - libfftw3-3 22 | - libfftw3-dev 23 | - libgmp3-dev 24 | - libmpfr6 25 | - libmpfr-dev 26 | - libhdf5-serial-dev 27 | - hdf5-tools 28 | - libblas-dev 29 | - liblapack-dev 30 | 31 | 32 | # Build documentation in the docs/ directory with Sphinx 33 | sphinx: 34 | configuration: doc/conf.py 35 | 36 | # If using Sphinx, optionally build your docs in additional formats such as PDF 37 | formats: 38 | - pdf 39 | - epub 40 | 41 | 42 | # Optionally declare the Python requirements required to build your docs 43 | python: 44 | install: 45 | - requirements: doc/requirements.txt 46 | system_packages: true 47 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include support/__init__.py 2 | include support/setup_codes.py 3 | 4 | recursive-include src * 5 | recursive-exclude src *.pyc *.o *~ .pc ccache *.a 6 | 7 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | OMUSE, a python framework for oceanographic simulations 2 | 3 | OMUSE consists of a framework ("the framework") and contributed codes 4 | ("the codes"). The codes are found under the community directory and may 5 | have their own license. The framework consists of everything else. 6 | 7 | For the framework: 8 | 9 | Copyright 2017 The AMUSE and OMUSE collaboration 10 | 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use the framework except in compliance with the License. 13 | You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | 23 | For the codes: 24 | 25 | The licenses for the codes can be found under their respective directories 26 | in the community subdirectory. 27 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = OMUSE 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /doc/dales: -------------------------------------------------------------------------------- 1 | ../src/omuse/community/dales/doc -------------------------------------------------------------------------------- /doc/era5: -------------------------------------------------------------------------------- 1 | ../src/omuse/community/era5/doc -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | .. OMUSE documentation master file, created by 2 | sphinx-quickstart on Tue Jul 30 14:59:01 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to OMUSE's documentation! 7 | ================================= 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | :caption: Contents: 12 | 13 | installing 14 | dales/dales 15 | era5/era5 16 | asynchronous 17 | units 18 | singularity 19 | 20 | 21 | Indices and tables 22 | ================== 23 | 24 | * :ref:`genindex` 25 | * :ref:`modindex` 26 | * :ref:`search` 27 | -------------------------------------------------------------------------------- /doc/installing.rst: -------------------------------------------------------------------------------- 1 | Installing OMUSE 2 | ================ 3 | 4 | Install required programs and libraries: 5 | 6 | * make 7 | * cmake 8 | * python 3 9 | * gcc 10 | * gfortran 11 | * mpi 12 | * netCDF including Fortran bindings 13 | * git 14 | * mercurial 15 | 16 | Set up and activate a virtual Python environment:: 17 | 18 | python3 -m venv omuse_env 19 | source omuse_env/bin/activate 20 | 21 | Get the OMUSE source code, install its Python dependencies and set up a development build of OMUSE, where the codes will be built in place:: 22 | 23 | git clone https://github.com/omuse-geoscience/omuse/ 24 | cd omuse/ 25 | pip install -e . 26 | export DOWNLOAD_CODES=1 27 | 28 | Build codes, select the ones needed:: 29 | 30 | python setup.py build_code --code-name dales --inplace 31 | python setup.py build_code --code-name cdo --inplace 32 | python setup.py build_code --code-name qgcm --inplace 33 | python setup.py build_code --code-name qgmodel --inplace 34 | python setup.py build_code --code-name swan --inplace 35 | python setup.py build_code --code-name pop --inplace 36 | 37 | or try to build all of them:: 38 | 39 | python setup.py develop_build 40 | 41 | Install Jupyter in the virtual environment, and make the virtual environment's Python available as a kernel in Jupyter 42 | 43 | python -m pip install ipykernel matplotlib 44 | python -m ipykernel install --user --name=omuse-env 45 | 46 | 47 | Alternatively, see :ref:`Singularity-section` for instructions for setting up and using a Singularity container with 48 | OMUSE and Jupyter. 49 | 50 | 51 | Code versions 52 | ------------- 53 | 54 | For DALES, there are additional options controlling which version of the code is used: 55 | setting `DOWNLOAD_CODES=1` performs a shallow checkout of a single tag, while `DOWNLOAD_CODES="all"` 56 | clones the whole DALES git repository, which is useful for development. 57 | The environment variable `DALES_GIT_TAG` can be used to control which 58 | branch or version tag to check out. 59 | By default the variable points to a version tag in the DALES repository, which is tested to 60 | work with the current OMUSE. 61 | -------------------------------------------------------------------------------- /doc/requirements.txt: -------------------------------------------------------------------------------- 1 | setuptools 2 | wheel 3 | amuse-framework>=13.0.0.b3 4 | -------------------------------------------------------------------------------- /doc/singularity.rst: -------------------------------------------------------------------------------- 1 | .. _Singularity-section: 2 | 3 | Singularity image 4 | ================= 5 | 6 | A Singularity recipe is included with OMUSE. When building it, the result is a Singularity image 7 | which is a portable way to test OMUSE and the included models. 8 | 9 | The image includes Jupyter for interactive Python notebooks and the following OMUSE models: 10 | 11 | * cdo 12 | * dales 13 | * qgcm (hogg2006,ocean_only,hogg2006_20km) 14 | * qgmodel 15 | * swan 16 | 17 | 18 | 19 | Building the image:: 20 | 21 | sudo singularity build omuse.img Singularity 22 | 23 | Create a directory which the container can use at runtime for storing notebooks:: 24 | 25 | mkdir run 26 | 27 | Launch the container to start Jupyter server inside:: 28 | 29 | singularity run --contain -B examples:/opt/notebooks,run:/run/user omuse.img 30 | 31 | Then visit the reported localhost:8888 with a browser. 32 | 33 | In the singularity command above, the --contain option disables mounting your home directory whereas the -B option specifies paths that will be mounted inside the container, in this case the examples distributed with OMUSE. If you have a folder with notebooks using OMUSE, you can mount this instead of the examples directory to execute them with the singularity container. The container above can also be used to run a regular python script that uses OMUSE functionality by piping the contents to the container python command:: 34 | 35 | cat myscript.py | singularity exec --contain omuse.img python3 36 | 37 | Finally, it is also possible to launch a shell inside the container:: 38 | 39 | singularity shell --contain -B run:/run/user omuse.img 40 | 41 | to execute your python code with all OMUSE dependencies findable. We advise to use the --contain option whenever you 42 | have OMUSE installed on your host system in $HOME/.local . 43 | -------------------------------------------------------------------------------- /doc/tutorial/amuserc: -------------------------------------------------------------------------------- 1 | [output] 2 | printing_strategy=simple 3 | -------------------------------------------------------------------------------- /doc/units.rst: -------------------------------------------------------------------------------- 1 | .. _units: 2 | 3 | Units in OMUSE 4 | ============== 5 | 6 | OMUSE code interfaces use quantities with units. 7 | This has the advantages that the units of any 8 | quantitiy is explicitly specified, and that 9 | automatic conversion can be done between different units. 10 | 11 | Unit example:: 12 | 13 | from omuse.units import units 14 | 15 | # units are attached to a number with the | operator: 16 | velocity = 3 | units.m / units.s 17 | mass = 0.002 | units.kg 18 | 19 | print('velocity', velocity) 20 | 21 | # a quantity can be separated into a number and a unit 22 | print('number:', velocity.number, 'unit:', velocity.unit) 23 | print() 24 | 25 | print('mass', mass) 26 | 27 | # get value in a different unit 28 | print(mass.value_in(units.g), 'g') 29 | print() 30 | 31 | # arithmetic on quantities: 32 | print('momentum:', mass * velocity) 33 | 34 | output:: 35 | 36 | velocity 3 m / s 37 | number: 3 unit: m / s 38 | 39 | mass 0.002 kg 40 | 2.0 g 41 | 42 | momentum: 0.006 m * kg * s**-1 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | ## examples ## 2 | 3 | * bubble-notebook.ipynb: Jupyter notebook containing a DALES convective bubble experiment 4 | 5 | The Dales code directory contains a number of examples for its use (src/omuse/community/dales/example). 6 | 7 | More examples can be found at: https://github.com/omuse-geoscience/omuse-examples 8 | -------------------------------------------------------------------------------- /generate_ci.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | BASEPATH="$( cd "$(dirname "$0")/" ; pwd -P)" 3 | 4 | if [ "$#" -eq 0 ]; then 5 | OUTFILE="$BASEPATH/.github/workflows/omuse-ci.yml" 6 | elif [ "$#" -eq 1 ]; then 7 | OUTFILE="$1" 8 | else 9 | printf "Too many arguments!\n" 10 | printf "Usage:\n" 11 | printf "$(basename "$0") \n" 12 | exit 1 13 | fi 14 | 15 | cat "$BASEPATH/.github/workflows/templates/preamble" >"$OUTFILE" 16 | for pkg in `cd "$BASEPATH/packages" && ls -d omuse-*`; do 17 | printf " $pkg:\n" 18 | cat "$BASEPATH/.github/workflows/templates/matrix" 19 | printf " name: $pkg - (\${{ join(matrix.*, ', ') }})\n" 20 | sed "s/PKG_NAME/$pkg/" "$BASEPATH/.github/workflows/templates/pkg-preamble" 21 | 22 | if [ -f "$BASEPATH/.github/workflows/templates/deps-$pkg" ]; then 23 | cat "$BASEPATH/.github/workflows/templates/deps-$pkg" 24 | fi 25 | 26 | sed "s/PKG_NAME/$pkg/" "$BASEPATH/.github/workflows/templates/pkg-install" 27 | printf "\n" 28 | done >>"$OUTFILE" 29 | 30 | -------------------------------------------------------------------------------- /omuse_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/omuse_logo.png -------------------------------------------------------------------------------- /packages/community_package_names: -------------------------------------------------------------------------------- 1 | era5 2 | qgmodel 3 | swan 4 | iemic 5 | -------------------------------------------------------------------------------- /packages/generate_packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p dist 4 | 5 | for p in omuse* 6 | do 7 | cd $p || exit $? 8 | rm -rf dist || exit $? 9 | python setup.py sdist || exit $? 10 | # Issue with setuptools_scm root handling 11 | # https://github.com/pypa/setuptools_scm/issues/188 12 | # To be updated after new version of setuptools_scm using: 13 | # https://github.com/pypa/setuptools_scm/pull/870 14 | cd dist 15 | tarname=$(ls *.tar.gz) 16 | tar -xzf $tarname 17 | pname=$(basename $tarname .tar.gz) 18 | toml_file=$(ls $pname/*.toml) 19 | echo $toml_file 20 | sed -i '/root/d' $toml_file 21 | tar -czf $tarname $pname 22 | cd - 23 | cp dist/*.tar.gz ../dist/ || exit $? 24 | cd .. 25 | done 26 | -------------------------------------------------------------------------------- /packages/generate_setupfiles.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | while read -r line; do 4 | pkgdir=$(echo "print('omuse-${line}'.lower())" | python); 5 | echo ${pkgdir} 6 | python setup_template.py ${line} > ${pkgdir}/setup.py; 7 | python pyproject_template.py ${line} > ${pkgdir}/pyproject.toml; 8 | done < community_package_names 9 | -------------------------------------------------------------------------------- /packages/omuse-era5/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include support/__init__.py 2 | include support/setup_codes.py 3 | include support/version.py 4 | include support/classifiers.py 5 | include pyproject.toml 6 | 7 | recursive-include src * 8 | recursive-exclude src *.pyc *.o *~ .pc ccache *.a 9 | 10 | -------------------------------------------------------------------------------- /packages/omuse-era5/README.md: -------------------------------------------------------------------------------- 1 | This package installs the ERA5 interface for OMUSE. 2 | 3 | In order to use the ERA5 interface, UID and API key from the CDS portal is 4 | needed (see the documentation for [CDSAPI](https://pypi.org/project/cdsapi/) 5 | for more details). 6 | -------------------------------------------------------------------------------- /packages/omuse-era5/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ "setuptools>=65.0.0", "wheel", "omuse-framework", "setuptools_scm", "numpy" ] 3 | 4 | [project] 5 | name = "omuse-era5" 6 | dynamic = ["version"] 7 | 8 | [tool.setuptools_scm] 9 | write_to = "src/omuse/version.py" 10 | root = "../.." 11 | -------------------------------------------------------------------------------- /packages/omuse-era5/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from support.classifiers import classifiers 3 | from setuptools import setup 4 | import support 5 | support.use("system") 6 | support.set_package_name("omuse") 7 | from support.setup_codes import setup_commands 8 | name = 'omuse-era5' 9 | author = 'The AMUSE/OMUSE team' 10 | author_email = 'info@amusecode.org' 11 | license_ = "Apache License 2.0" 12 | url = 'https://github.com/omuse-geoscience/omuse' 13 | install_requires = [ 14 | 'omuse-framework', 15 | 'cdsapi' 16 | ] 17 | description = 'The Oceanographic Multi-purpose Software Environment - ERA5 interface' 18 | with open("README.md", "r") as fh: 19 | long_description = fh.read() 20 | long_description_content_type = "text/markdown" 21 | 22 | extensions = [] 23 | 24 | all_data_files = [] 25 | 26 | packages = [ 27 | 'omuse.community.era5', 28 | ] 29 | package_data = { 30 | } 31 | 32 | mapping_from_command_name_to_command_class = setup_commands() 33 | 34 | setup( 35 | name=name, 36 | classifiers=classifiers, 37 | url=url, 38 | author_email=author_email, 39 | author=author, 40 | license=license_, 41 | description=description, 42 | long_description=long_description, 43 | long_description_content_type=long_description_content_type, 44 | install_requires=install_requires, 45 | python_requires=">=3.5", 46 | cmdclass=mapping_from_command_name_to_command_class, 47 | ext_modules=extensions, 48 | package_dir={ 49 | 'omuse.community.era5': 'src/omuse/community/era5', 50 | }, 51 | packages=packages, 52 | package_data=package_data, 53 | data_files=all_data_files, 54 | ) 55 | -------------------------------------------------------------------------------- /packages/omuse-era5/src/omuse/community/era5: -------------------------------------------------------------------------------- 1 | ../../../../../src/omuse/community/era5 -------------------------------------------------------------------------------- /packages/omuse-era5/support: -------------------------------------------------------------------------------- 1 | ../../support -------------------------------------------------------------------------------- /packages/omuse-framework/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include support/__init__.py 2 | include support/setup_codes.py 3 | include support/classifiers.py 4 | include pyproject.toml 5 | 6 | recursive-include src/omuse * 7 | recursive-exclude src *.pyc *.o *~ .pc ccache *.a 8 | 9 | recursive-exclude src/omuse/community * 10 | 11 | include src/omuse/community/__init__.py 12 | 13 | recursive-exclude src *.pyc *.o *~ .pc ccache *.a *.so *.mod 14 | recursive-exclude lib *.pyc *.o *~ ccache *.a *.so *.mod 15 | recursive-exclude support *.pyc *.o *~ ccache *.a 16 | 17 | -------------------------------------------------------------------------------- /packages/omuse-framework/README.md: -------------------------------------------------------------------------------- 1 | This package installs the base OMUSE framework. 2 | -------------------------------------------------------------------------------- /packages/omuse-framework/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ "setuptools>=65.0.0", "wheel", "setuptools_scm", "numpy" ] 3 | 4 | [project] 5 | name = "omuse-framework" 6 | dynamic = ["version"] 7 | 8 | [tool.setuptools_scm] 9 | write_to = "src/omuse/version.py" 10 | root = "../.." 11 | -------------------------------------------------------------------------------- /packages/omuse-framework/setup.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | 4 | from setuptools import setup, find_packages 5 | import support 6 | support.use("system") 7 | support.set_package_name("omuse") 8 | from support.setup_codes import setup_commands 9 | from support.classifiers import classifiers 10 | 11 | name = 'omuse-framework' 12 | author = 'The Amuse/ Omuse Team' 13 | author_email = 'info@amusecode.org' 14 | license_ = "Apache License 2.0" 15 | url = 'https://github.com/omuse-geoscience/omuse' 16 | install_requires = [ 17 | 'wheel>=0.32', 18 | 'docutils>=0.6', 19 | 'numpy>=1.2.2', 20 | 'nose>=0.11.1', 21 | 'mpi4py>=1.1.0', 22 | 'h5py>=1.1.0', 23 | 'amuse-framework>=2021.3.1', 24 | 'netCDF4>=1.4.0', 25 | 'f90nml>=1.0.0' 26 | ] 27 | description = 'The Oceanographic Multi-purpose Software Environment: base framework ' 28 | with open("README.md", "r") as fh: 29 | long_description = fh.read() 30 | long_description_content_type = "text/markdown" 31 | 32 | extensions = [] 33 | 34 | all_data_files = [] 35 | 36 | packages = find_packages('src', exclude=["omuse.community.*"]) 37 | 38 | package_data = { 39 | } 40 | 41 | mapping_from_command_name_to_command_class=setup_commands() 42 | 43 | setup( 44 | name=name, 45 | classifiers=classifiers, 46 | url=url, 47 | author_email=author_email, 48 | author=author, 49 | license=license_, 50 | description=description, 51 | long_description=long_description, 52 | long_description_content_type=long_description_content_type, 53 | install_requires=install_requires, 54 | #~ extras_require = { 55 | #~ "MPI" : ["mpi4py>=1.1.0"] 56 | #~ }, 57 | cmdclass=mapping_from_command_name_to_command_class, 58 | ext_modules=extensions, 59 | package_dir = {'': 'src'}, 60 | packages=packages, 61 | package_data=package_data, 62 | data_files=all_data_files, 63 | ) 64 | -------------------------------------------------------------------------------- /packages/omuse-framework/src/omuse: -------------------------------------------------------------------------------- 1 | ../../../src/omuse -------------------------------------------------------------------------------- /packages/omuse-framework/support: -------------------------------------------------------------------------------- 1 | ../../support -------------------------------------------------------------------------------- /packages/omuse-iemic/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include support/__init__.py 2 | include support/setup_codes.py 3 | include support/classifiers.py 4 | include pyproject.toml 5 | 6 | recursive-include src * 7 | recursive-exclude src *.pyc *.o *~ .pc ccache *.a *.orig iemic_worker 8 | recursive-exclude src fort.* *.h5 *h5.bak worker_code.* 9 | recursive-exclude src/omuse/community/iemic/data * 10 | recursive-exclude src/omuse/community/iemic/src/opt * 11 | recursive-exclude src/omuse/community/iemic/src/i-emic/.git * 12 | recursive-exclude src/omuse/community/iemic/src/i-emic/.github * 13 | recursive-exclude src/omuse/community/iemic/src/i-emic/build * 14 | recursive-exclude src/omuse/community/iemic/src/i-emic/data * 15 | recursive-exclude src/omuse/community/iemic/src/i-emic/doc * 16 | recursive-exclude src/omuse/community/iemic/src/i-emic/legacy * 17 | recursive-exclude src/omuse/community/iemic/src/i-emic/matlab * 18 | recursive-exclude src/omuse/community/iemic/src/i-emic/notes * 19 | recursive-exclude src/omuse/community/iemic/src/i-emic/parameterfiles * 20 | recursive-exclude src/omuse/community/iemic/src/i-emic/run * 21 | recursive-exclude src/omuse/community/iemic/src/i-emic/scripts * 22 | recursive-exclude src/omuse/community/iemic/src/i-emic/test * 23 | recursive-exclude src/omuse/community/iemic/src/jdqzpp/.git * 24 | recursive-exclude src/omuse/community/iemic/src/jdqzpp/build * 25 | -------------------------------------------------------------------------------- /packages/omuse-iemic/README.md: -------------------------------------------------------------------------------- 1 | This package installs the i-emic community code for OMUSE. 2 | -------------------------------------------------------------------------------- /packages/omuse-iemic/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ "setuptools>=65.0.0", "wheel", "omuse-framework", "setuptools_scm", "numpy" ] 3 | 4 | [project] 5 | name = "omuse-iemic" 6 | dynamic = ["version"] 7 | 8 | [tool.setuptools_scm] 9 | write_to = "src/omuse/version.py" 10 | root = "../.." 11 | -------------------------------------------------------------------------------- /packages/omuse-iemic/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from support.classifiers import classifiers 3 | from setuptools import setup 4 | import support 5 | support.use("system") 6 | support.set_package_name("omuse") 7 | from support.setup_codes import setup_commands 8 | name = 'omuse-iemic' 9 | author = 'The AMUSE/OMUSE team' 10 | author_email = 'info@amusecode.org' 11 | license_ = "Apache License 2.0" 12 | url = 'https://github.com/omuse-geoscience/omuse' 13 | install_requires = [ 14 | 'omuse-framework', 15 | ] 16 | description = 'The Oceanographic Multi-purpose Software Environment - iemic' 17 | with open("README.md", "r") as fh: 18 | long_description = fh.read() 19 | long_description_content_type = "text/markdown" 20 | 21 | extensions = [] 22 | 23 | all_data_files = [] 24 | 25 | packages = [ 26 | 'omuse.community.iemic', 27 | ] 28 | package_data = { 29 | } 30 | 31 | mapping_from_command_name_to_command_class = setup_commands() 32 | 33 | setup( 34 | name=name, 35 | classifiers=classifiers, 36 | url=url, 37 | author_email=author_email, 38 | author=author, 39 | license=license_, 40 | description=description, 41 | long_description=long_description, 42 | long_description_content_type=long_description_content_type, 43 | install_requires=install_requires, 44 | python_requires=">=3.5", 45 | cmdclass=mapping_from_command_name_to_command_class, 46 | ext_modules=extensions, 47 | package_dir={ 48 | 'omuse.community.iemic': 'src/omuse/community/iemic', 49 | }, 50 | packages=packages, 51 | package_data=package_data, 52 | data_files=all_data_files, 53 | ) 54 | -------------------------------------------------------------------------------- /packages/omuse-iemic/src/omuse/community/iemic: -------------------------------------------------------------------------------- 1 | ../../../../../src/omuse/community/iemic/ -------------------------------------------------------------------------------- /packages/omuse-iemic/support: -------------------------------------------------------------------------------- 1 | ../../support/ -------------------------------------------------------------------------------- /packages/omuse-qgmodel/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include support/__init__.py 2 | include support/setup_codes.py 3 | include support/version.py 4 | include support/classifiers.py 5 | include pyproject.toml 6 | 7 | recursive-include src * 8 | recursive-exclude src *.pyc *.o *~ .pc ccache *.a 9 | 10 | -------------------------------------------------------------------------------- /packages/omuse-qgmodel/README.md: -------------------------------------------------------------------------------- 1 | This package installs the qgmodel community code for OMUSE. 2 | -------------------------------------------------------------------------------- /packages/omuse-qgmodel/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ "setuptools>=65.0.0", "wheel", "omuse-framework", "setuptools_scm", "numpy" ] 3 | 4 | [project] 5 | name = "omuse-qgmodel" 6 | dynamic = ["version"] 7 | 8 | [tool.setuptools_scm] 9 | write_to = "src/omuse/version.py" 10 | root = "../.." 11 | -------------------------------------------------------------------------------- /packages/omuse-qgmodel/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from support.classifiers import classifiers 3 | from setuptools import setup 4 | import support 5 | support.use("system") 6 | support.set_package_name("omuse") 7 | from support.setup_codes import setup_commands 8 | name = 'omuse-qgmodel' 9 | author = 'The AMUSE/OMUSE team' 10 | author_email = 'info@amusecode.org' 11 | license_ = "Apache License 2.0" 12 | url = 'https://github.com/omuse-geoscience/omuse' 13 | install_requires = [ 14 | 'omuse-framework', 15 | ] 16 | description = 'The Oceanographic Multi-purpose Software Environment - qgmodel' 17 | with open("README.md", "r") as fh: 18 | long_description = fh.read() 19 | long_description_content_type = "text/markdown" 20 | 21 | extensions = [] 22 | 23 | all_data_files = [] 24 | 25 | packages = [ 26 | 'omuse.community.qgmodel', 27 | ] 28 | package_data = { 29 | } 30 | 31 | mapping_from_command_name_to_command_class = setup_commands() 32 | 33 | setup( 34 | name=name, 35 | classifiers=classifiers, 36 | url=url, 37 | author_email=author_email, 38 | author=author, 39 | license=license_, 40 | description=description, 41 | long_description=long_description, 42 | long_description_content_type=long_description_content_type, 43 | install_requires=install_requires, 44 | python_requires=">=3.5", 45 | cmdclass=mapping_from_command_name_to_command_class, 46 | ext_modules=extensions, 47 | package_dir={ 48 | 'omuse.community.qgmodel': 'src/omuse/community/qgmodel', 49 | }, 50 | packages=packages, 51 | package_data=package_data, 52 | data_files=all_data_files, 53 | ) 54 | -------------------------------------------------------------------------------- /packages/omuse-qgmodel/src/omuse/community/qgmodel: -------------------------------------------------------------------------------- 1 | ../../../../../src/omuse/community/qgmodel -------------------------------------------------------------------------------- /packages/omuse-qgmodel/support: -------------------------------------------------------------------------------- 1 | ../../support -------------------------------------------------------------------------------- /packages/omuse-swan/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include support/__init__.py 2 | include support/setup_codes.py 3 | include support/version.py 4 | include support/classifiers.py 5 | include pyproject.toml 6 | 7 | recursive-include src * 8 | recursive-exclude src *.pyc *.o *~ .pc ccache *.a 9 | 10 | -------------------------------------------------------------------------------- /packages/omuse-swan/README.md: -------------------------------------------------------------------------------- 1 | This package installs the SWAN community code for OMUSE. 2 | 3 | SWAN is a third-generation wave model, developed at Delft University of Technology, that computes random, short-crested wind-generated waves in coastal regions and inland waters. 4 | 5 | The latest version of SWAN can be found at [here](http://swanmodel.sourceforge.net) 6 | -------------------------------------------------------------------------------- /packages/omuse-swan/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ "setuptools>=65.0.0", "wheel", "omuse-framework", "setuptools_scm", "numpy" ] 3 | 4 | [project] 5 | name = "omuse-swan" 6 | dynamic = ["version"] 7 | 8 | [tool.setuptools_scm] 9 | write_to = "src/omuse/version.py" 10 | root = "../.." 11 | -------------------------------------------------------------------------------- /packages/omuse-swan/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from support.classifiers import classifiers 3 | from setuptools import setup 4 | import support 5 | support.use("system") 6 | support.set_package_name("omuse") 7 | from support.setup_codes import setup_commands 8 | name = 'omuse-swan' 9 | author = 'The AMUSE/OMUSE team' 10 | author_email = 'info@amusecode.org' 11 | license_ = "Apache License 2.0" 12 | url = 'https://github.com/omuse-geoscience/omuse' 13 | install_requires = [ 14 | 'omuse-framework', 15 | ] 16 | description = 'The Oceanographic Multi-purpose Software Environment - SWAN' 17 | with open("README.md", "r") as fh: 18 | long_description = fh.read() 19 | long_description_content_type = "text/markdown" 20 | 21 | extensions = [] 22 | 23 | all_data_files = [] 24 | 25 | packages = [ 26 | 'omuse.community.swan', 27 | ] 28 | package_data = { 29 | } 30 | 31 | mapping_from_command_name_to_command_class = setup_commands() 32 | 33 | setup( 34 | name=name, 35 | classifiers=classifiers, 36 | url=url, 37 | author_email=author_email, 38 | author=author, 39 | license=license_, 40 | description=description, 41 | long_description=long_description, 42 | long_description_content_type=long_description_content_type, 43 | install_requires=install_requires, 44 | python_requires=">=3.5", 45 | cmdclass=mapping_from_command_name_to_command_class, 46 | ext_modules=extensions, 47 | package_dir={ 48 | 'omuse.community.swan': 'src/omuse/community/swan', 49 | }, 50 | packages=packages, 51 | package_data=package_data, 52 | data_files=all_data_files, 53 | ) 54 | -------------------------------------------------------------------------------- /packages/omuse-swan/src/omuse/community/swan: -------------------------------------------------------------------------------- 1 | ../../../../../src/omuse/community/swan -------------------------------------------------------------------------------- /packages/omuse-swan/support: -------------------------------------------------------------------------------- 1 | ../../support -------------------------------------------------------------------------------- /packages/omuse/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include support/__init__.py 2 | include support/setup_codes.py 3 | include support/version.py 4 | include support/classifiers.py 5 | include pyproject.toml 6 | 7 | -------------------------------------------------------------------------------- /packages/omuse/README.md: -------------------------------------------------------------------------------- 1 | This package installs all available OMUSE packages. 2 | -------------------------------------------------------------------------------- /packages/omuse/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ "omuse-framework>=1.2.0", "omuse-qgmodel>=1.2.0"] 3 | -------------------------------------------------------------------------------- /packages/omuse/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | from support.classifiers import classifiers 3 | from setuptools_scm import get_version 4 | 5 | version_full = get_version( 6 | root='../..', 7 | relative_to=__file__, 8 | ) 9 | 10 | version = '.'.join(version_full.split('.')[:2]) 11 | 12 | name = 'omuse' 13 | author = 'The AMUSE/ OMUSE team' 14 | author_email = 'info@amusecode.org' 15 | license_ = "Apache License 2.0" 16 | url = 'https://github.com/omuse-geoscience/omuse' 17 | install_requires = [ 18 | 'omuse-framework>=%s' % version, 19 | 'omuse-qgmodel>=%s' % version 20 | ] 21 | description = 'The Oceanographic Multi-purpose Software Environment: a package for multi-physics and multi-scale earth science simulations. ' 22 | with open("README.md", "r") as fh: 23 | long_description = fh.read() 24 | long_description_content_type = "text/markdown" 25 | 26 | try: 27 | from src.omuse.version import version 28 | use_scm_version = False 29 | setup_requires = [] 30 | except ImportError: 31 | version = False 32 | setup_requires = ['setuptools_scm'] 33 | use_scm_version = { 34 | "root": "../..", 35 | "relative_to": __file__, 36 | } 37 | 38 | setup( 39 | name=name, 40 | use_scm_version=use_scm_version, 41 | setup_requires=setup_requires, 42 | version=version, 43 | classifiers=classifiers, 44 | url=url, 45 | author_email=author_email, 46 | author=author, 47 | license=license_, 48 | description=description, 49 | long_description=long_description, 50 | long_description_content_type=long_description_content_type, 51 | install_requires=install_requires, 52 | python_requires=">=3.5", 53 | ) 54 | -------------------------------------------------------------------------------- /packages/omuse/support: -------------------------------------------------------------------------------- 1 | ../../support -------------------------------------------------------------------------------- /packages/pyproject_template.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import sys 3 | 4 | name = sys.argv[1] 5 | setupstring = '''[build-system] 6 | 7 | requires = [ "setuptools>=65.0.0", "wheel", "omuse-framework", "setuptools_scm", "numpy" ] 8 | 9 | [project] 10 | name = "omuse-{name_lowercase}" 11 | dynamic = ["version"] 12 | 13 | [tool.setuptools_scm] 14 | write_to = "src/omuse/version.py" 15 | root = "../.." 16 | ''' 17 | print(setupstring.format(name=name, name_lowercase=name.lower())) 18 | -------------------------------------------------------------------------------- /packages/setup_template.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import sys 3 | 4 | name = sys.argv[1] 5 | setupstring = '''#!/usr/bin/env python3 6 | from support.classifiers import classifiers 7 | from setuptools import setup 8 | import support 9 | support.use("system") 10 | support.set_package_name("omuse") 11 | from support.setup_codes import setup_commands 12 | name = 'omuse-{name_lowercase}' 13 | author = 'The AMUSE/OMUSE team' 14 | author_email = 'info@amusecode.org' 15 | license_ = "Apache License 2.0" 16 | url = 'https://github.com/omuse-geoscience/omuse' 17 | install_requires = [ 18 | 'omuse-framework', 19 | ] 20 | description = 'The Oceanographic Multi-purpose Software Environment - {name}' 21 | with open("README.md", "r") as fh: 22 | long_description = fh.read() 23 | long_description_content_type = "text/markdown" 24 | 25 | extensions = [] 26 | 27 | all_data_files = [] 28 | 29 | packages = [ 30 | 'omuse.community.{name_lowercase}', 31 | ] 32 | package_data = {{ 33 | }} 34 | 35 | mapping_from_command_name_to_command_class = setup_commands() 36 | 37 | setup( 38 | name=name, 39 | classifiers=classifiers, 40 | url=url, 41 | author_email=author_email, 42 | author=author, 43 | license=license_, 44 | description=description, 45 | long_description=long_description, 46 | long_description_content_type=long_description_content_type, 47 | install_requires=install_requires, 48 | python_requires=">=3.5", 49 | cmdclass=mapping_from_command_name_to_command_class, 50 | ext_modules=extensions, 51 | package_dir={{ 52 | 'omuse.community.{name_lowercase}': 'src/omuse/community/{name_lowercase}', 53 | }}, 54 | packages=packages, 55 | package_data=package_data, 56 | data_files=all_data_files, 57 | )''' 58 | print(setupstring.format(name=name, name_lowercase=name.lower())) 59 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ "setuptools>=45.0.0", "setuptools_scm", "pip>=19.0.0", "wheel" ] 3 | 4 | [tool.setuptools_scm] 5 | write_to = "src/omuse/version.py" 6 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | 4 | from setuptools import setup, find_packages 5 | import support 6 | support.use("system") 7 | support.set_package_name("omuse") 8 | from support.setup_codes import setup_commands 9 | from support.classifiers import classifiers 10 | 11 | name = 'omuse-devel' 12 | author = 'The Amuse/ Omuse Team' 13 | author_email = 'info@amusecode.org' 14 | license_ = "Apache License 2.0" 15 | url = 'https://github.com/omuse-geoscience/omuse' 16 | install_requires = [ 17 | 'wheel>=0.32', 18 | 'docutils>=0.6', 19 | 'numpy>=1.2.2', 20 | 'nose>=0.11.1', 21 | 'mpi4py>=1.1.0', 22 | 'h5py>=1.1.0', 23 | 'amuse-devel>=13.1.0', # omuse-devel implies amuse-devel: 24 | 'netCDF4>=1.4.0', 25 | 'f90nml>=1.0.0', 26 | 'transiflow @ https://github.com/BIMAU/transiflow/tarball/master' 27 | ] 28 | description = 'The Oceanographic Multi-purpose Software Environment: a package for multi-physics and multi-scale earth science simulations.' 29 | with open("README.md", "r") as fh: 30 | long_description = fh.read() 31 | long_description_content_type = "text/markdown" 32 | 33 | extensions = [] 34 | 35 | all_data_files = [] 36 | 37 | packages = find_packages('src') 38 | 39 | package_data = { 40 | } 41 | 42 | mapping_from_command_name_to_command_class=setup_commands() 43 | 44 | setup( 45 | name=name, 46 | use_scm_version={ 47 | "write_to": "src/omuse/version.py", 48 | }, 49 | setup_requires=['setuptools_scm'], 50 | classifiers=classifiers, 51 | url=url, 52 | author_email=author_email, 53 | author=author, 54 | license=license_, 55 | description=description, 56 | long_description=long_description, 57 | long_description_content_type=long_description_content_type, 58 | install_requires=install_requires, 59 | #~ extras_require= { "amuse" : "amuse", "amuse-framework" : "amuse-framework" }, 60 | cmdclass=mapping_from_command_name_to_command_class, 61 | ext_modules=extensions, 62 | package_dir = {'': 'src'}, 63 | packages=packages, 64 | package_data=package_data, 65 | data_files=all_data_files, 66 | ) 67 | -------------------------------------------------------------------------------- /src/omuse/__init__.py: -------------------------------------------------------------------------------- 1 | from amuse.support.literature import TrackLiteratureReferences, LiteratureReferencesMixIn 2 | 3 | class OMUSE(LiteratureReferencesMixIn): 4 | """ 5 | .. [#] OMUSE 1.0: a framework for multi-model oceanographic simulations, Pelupessy et al., Geoscientific Model Development, 10, 3167 6 | """ 7 | 8 | @classmethod 9 | def version(cls): 10 | """ 11 | Overide the class-method from AMUSE, so we don't accidentally report 12 | the AMUSE version instead of the OMUSE version. 13 | """ 14 | 15 | try: 16 | from omuse.version import version 17 | except (ImportError): 18 | version = "unknown" 19 | 20 | return version 21 | 22 | TrackLiteratureReferences.default().register_class(OMUSE) 23 | -------------------------------------------------------------------------------- /src/omuse/community/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/__init__.py -------------------------------------------------------------------------------- /src/omuse/community/adcirc/Makefile: -------------------------------------------------------------------------------- 1 | ifeq ($(origin AMUSE_DIR), undefined) 2 | AMUSE_DIR := $(shell amusifier --get-amuse-dir) 3 | endif 4 | -include ${AMUSE_DIR}/config.mk 5 | 6 | CODE_GENERATOR = $(AMUSE_DIR)/build.py 7 | 8 | CLASSNAME=AdcircInterface 9 | 10 | FCFLAGS += -I./src/ -I./src/odir3/ 11 | 12 | ifeq ($(findstring gfortran, $(notdir $(FC))), gfortran) 13 | compiler="gnu" 14 | endif 15 | 16 | ifeq ($(findstring ifort, $(notdir $(FC))), ifort) 17 | compiler="intel" 18 | FCFLAGS+=-traceback 19 | endif 20 | 21 | 22 | all: src prep src/libamuse_adcirc.a src/amuse_adcirc.o adcirc_worker 23 | 24 | src: 25 | $(error "please link src to correct src_v[version] directory") 26 | 27 | src/adcirc_src/src/*.F: prep 28 | 29 | src/libamuse_adcirc.a: src/adcirc_src/src/*.F 30 | make -C src/ libamuse_adcirc.a BUILDTYPE=amuse FC="$(FC)" PFC="$(MPIFC)" compiler=$(compiler) FSO=-FI 31 | 32 | src/amuse_adcirc.o: src/amuse_adcirc.F90 33 | make -C src/ amuse_adcirc.o BUILDTYPE=amuse FC="$(FC)" PFC="$(MPIFC)" compiler=$(compiler) FSO=-FI 34 | 35 | worker_code.f90: interface.py 36 | $(CODE_GENERATOR) --type=f90 $< $(CLASSNAME) -o $@ 37 | 38 | adcirc_worker: worker_code.f90 interface.o src/amuse_adcirc.o src/libamuse_adcirc.a 39 | $(MPIFC) $(FCFLAGS) $(SC_FLAGS) $(FS_FLAGS) $^ -o $@ $(LIBS) $(SC_FCLIBS) $(FS_LIBS) 40 | 41 | prep: 42 | make -C src/ -f makefile_prep patched_source 43 | 44 | %.o: %.f90 45 | $(FC) $(FCFLAGS) -c -o $@ $< 46 | 47 | clean: 48 | -make -C src/ clean 49 | rm -f *.pyc *.mod 50 | rm -f interface.o adcirc_worker.f90 worker_code.f90 51 | rm -f adcirc_worker 52 | 53 | distclean: clean 54 | -make -C src/ LIBADC=libadcirc.a clobber 55 | make -C src/ -f makefile_prep distclean 56 | 57 | download: 58 | make -C src/ -f makefile_prep download 59 | 60 | update: 61 | make -C src/ -f makefile_prep update 62 | -------------------------------------------------------------------------------- /src/omuse/community/adcirc/__init__.py: -------------------------------------------------------------------------------- 1 | # relative import hack 2 | # https://stackoverflow.com/questions/16981921/relative-imports-in-python-3 3 | import os, sys; sys.path.append(os.path.dirname(os.path.realpath(__file__))) 4 | 5 | -------------------------------------------------------------------------------- /src/omuse/community/adcirc/adcirc/readme.txt: -------------------------------------------------------------------------------- 1 | directory for versions of the (unpatched) ADCIRC source, copy 2 | them here in seperate directories, e.g.: adcirc_v51_52_07 3 | -------------------------------------------------------------------------------- /src/omuse/community/adcirc/src: -------------------------------------------------------------------------------- 1 | src_v51 -------------------------------------------------------------------------------- /src/omuse/community/adcirc/src_v51/makefile_prep: -------------------------------------------------------------------------------- 1 | .PHONY: patch patched_source 2 | 3 | all: 4 | 5 | ADCIRC_VERSION=v51_52_07 6 | 7 | ADCIRC_SRC=../adcirc/adcirc_$(ADCIRC_VERSION) 8 | 9 | adcirc_src: | $(ADCIRC_SRC) 10 | cp -r $(ADCIRC_SRC) ./adcirc_src 11 | chmod +x ./adcirc_src/work/config.guess 12 | -cd adcirc_src; patch -N -p1 < ../adcirc.patch 13 | 14 | makefile: | adcirc_src 15 | cp ./adcirc_src/work/makefile ./ 16 | patch -N -p0 < ./makefile.patch 17 | 18 | patched_source: | adcirc_src makefile 19 | 20 | patch: 21 | diff -ruN $(ADCIRC_SRC) adcirc_src > adcirc.patch || exit 0 22 | diff -ruN $(ADCIRC_SRC)/work/makefile makefile > makefile.patch || exit 0 23 | 24 | distclean: 25 | rm -rf ./adcirc_src ./makefile 26 | 27 | $(ADCIRC_SRC): 28 | @echo "** make sure the (unpatched) ADCIRC source is in $(ADCIRC_SRC) **" 29 | 30 | #needs access to OMUSE private repos 31 | download: 32 | git clone git@github.com:omuse-geoscience/adcirc-$(ADCIRC_VERSION) adcirc_src 33 | 34 | update: adcirc_src/.git 35 | cd adcirc_src 36 | git pull 37 | 38 | adcirc_src/.git: 39 | @echo "** update needs a version controlled adcirc_src **" 40 | exit 1 41 | -------------------------------------------------------------------------------- /src/omuse/community/adcirc/src_v52/makefile_prep: -------------------------------------------------------------------------------- 1 | .PHONY: patch patched_source 2 | 3 | all: 4 | 5 | ADCIRC_VERSION=v52_30_02 6 | 7 | ADCIRC_SRC=../adcirc/adcirc_$(ADCIRC_VERSION) 8 | 9 | adcirc_src: | $(ADCIRC_SRC) 10 | cp -r $(ADCIRC_SRC) ./adcirc_src 11 | chmod +x ./adcirc_src/work/config.guess 12 | -cd adcirc_src; patch -N -p1 < ../adcirc.patch 13 | 14 | makefile: | adcirc_src 15 | cp ./adcirc_src/work/makefile ./ 16 | patch -N -p0 < ./makefile.patch 17 | 18 | patched_source: | adcirc_src makefile 19 | 20 | patch: 21 | diff -ruN $(ADCIRC_SRC) adcirc_src > adcirc.patch || exit 0 22 | diff -ruN $(ADCIRC_SRC)/work/makefile makefile > makefile.patch || exit 0 23 | 24 | distclean: 25 | rm -rf ./adcirc_src ./makefile 26 | 27 | $(ADCIRC_SRC): 28 | @echo "** make sure the (unpatched) ADCIRC source is in $(ADCIRC_SRC) **" 29 | 30 | #needs access to OMUSE private repos 31 | download: 32 | git clone git@github.com:omuse-geoscience/adcirc-$(ADCIRC_VERSION) adcirc_src 33 | 34 | update: adcirc_src/.git 35 | cd adcirc_src 36 | git pull 37 | 38 | adcirc_src/.git: 39 | @echo "** update needs a version controlled adcirc_src **" 40 | exit 1 41 | -------------------------------------------------------------------------------- /src/omuse/community/cdo/Makefile: -------------------------------------------------------------------------------- 1 | ifeq ($(origin AMUSE_DIR), undefined) 2 | AMUSE_DIR := $(shell amusifier --get-amuse-dir) 3 | endif 4 | -include ${AMUSE_DIR}/config.mk 5 | 6 | CFLAGS += -Wall -g 7 | CXXFLAGS += $(CFLAGS) 8 | LDFLAGS += -lm $(MUSE_LD_FLAGS) 9 | 10 | OBJS = interface.o 11 | 12 | CODE = cdo-1.7.0rc5 13 | 14 | CODELIB = $(CODE)/src/.libs/libcdo.a $(CODE)/src/libcdo-cdolib.a 15 | 16 | CDILIB = $(CODE)/libcdi/src/.libs/libcdi.a 17 | 18 | CODE_GENERATOR:=amusifier 19 | 20 | all: remapper_worker 21 | 22 | patches: src_original 23 | $(RM) -rf $(CODE) 24 | tar zxf cdo-current.tar.gz 25 | cd $(CODE); ./configure --disable-openmp --with-threads=no --with-netcdf=$(NETCDF_PREFIX) F77="$(FC)" FC="$(FC)" FCFLAGS="$(FCFLAGS)" LDFLAGS="$(LDFLAGS) $(NETCDF_LIBS)" 26 | cd .; ./make_patches.py diff 27 | $(RM) -rf $(CODE) 28 | 29 | clean: 30 | $(RM) -f *.so *.o *.pyc worker_code.cc worker_code.h 31 | $(RM) *~ remapper_worker worker_code.cc 32 | # make -C $(CODE) clean 33 | 34 | distclean: clean 35 | rm -rf $(CODE) src 36 | 37 | $(CODE): 38 | tar zxf cdo-current.tar.gz 39 | ln -s `tar -tf cdo-current.tar.gz | awk -F/ '{print $1;exit}'` src 40 | cd $(CODE); ./configure --disable-openmp --with-threads=no --with-netcdf=$(NETCDF_PREFIX) F77="$(FC)" FC="$(FC)" FCFLAGS="$(FCFLAGS)" LDFLAGS="$(LDFLAGS) $(NETCDF_LIBS)" 41 | cd .; ./make_patches.py patch 42 | cp script.ar $(CODE)/src/script.ar 43 | 44 | $(CODELIB): $(CODE) 45 | make -C $(CODE) 46 | make -C $(CODE)/src libcdo-cdolib.a 47 | 48 | worker_code.cc: interface.py worker_code.h 49 | $(CODE_GENERATOR) --type=c interface.py CDOInterface -o $@ 50 | 51 | worker_code.h: interface.py 52 | $(CODE_GENERATOR) --type=h interface.py CDOInterface -o $@ 53 | 54 | remapper_worker: worker_code.o $(CODELIB) $(OBJS) 55 | $(eval $(shell grep '\-luuid' cdo-1.7.0rc5/libcdi/Makefile)) 56 | $(MPICXX) $(CXXFLAGS) $< $(OBJS) $(CODELIB) $(CODELIB) $(CDILIB) -lm -lz $(NETCDF_LIBS) $(UUID_C_LIB) $(OPENMP_CFLAGS) -o $@ 57 | 58 | .cc.o: $< 59 | $(MPICXX) $(CXXFLAGS) -c -o $@ $< 60 | 61 | %.o: %.cc 62 | $(MPICXX) $(CXXFLAGS) -c -o $@ $< 63 | 64 | %.o: %.c 65 | $(MPICC) $(CXXFLAGS) -c -o $@ $< 66 | 67 | src_original: 68 | $(error copy the patched source to src_original first) 69 | 70 | .PHONY: patches 71 | -------------------------------------------------------------------------------- /src/omuse/community/cdo/__init__.py: -------------------------------------------------------------------------------- 1 | # generated file -------------------------------------------------------------------------------- /src/omuse/community/cdo/cdo-current.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/cdo/cdo-current.tar.gz -------------------------------------------------------------------------------- /src/omuse/community/cdo/grids/POP43.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/cdo/grids/POP43.nc -------------------------------------------------------------------------------- /src/omuse/community/cdo/grids/T42.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/cdo/grids/T42.nc -------------------------------------------------------------------------------- /src/omuse/community/cdo/grids/dipole-grid-320x384.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/cdo/grids/dipole-grid-320x384.nc -------------------------------------------------------------------------------- /src/omuse/community/cdo/grids/dst_grid.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/cdo/grids/dst_grid.nc -------------------------------------------------------------------------------- /src/omuse/community/cdo/grids/nc_inundation_v6c.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/cdo/grids/nc_inundation_v6c.nc -------------------------------------------------------------------------------- /src/omuse/community/cdo/grids/src_grid.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/cdo/grids/src_grid.nc -------------------------------------------------------------------------------- /src/omuse/community/cdo/make_patches.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import sys 5 | 6 | #purpose of this script: 7 | # 8 | #calling: 9 | #diff -u cdo-1.7.0rc5/src/Makefile src/src/Makefile > makefile.patch 10 | # or 11 | #patch cdo-1.7.0rc5/src/Makefile < makefile.patch 12 | # 13 | #for a bunch of files 14 | 15 | code = "cdo-1.7.0rc5" 16 | 17 | source_dir = "src_original/src/" 18 | target_dir = code + "/src/" 19 | patch_dir = "patches/" 20 | 21 | files = ["Makefile", "remap_scrip_io.c", "remap_conserv_scrip.c", "EOFs.c" ] 22 | 23 | def make_patches(filename): 24 | command = 'diff' + " -I [C/]" + ' -u ' + target_dir + filename + " " + source_dir + filename + ' > ' + patch_dir + filename + ".patch" 25 | print(command) 26 | os.system(command) 27 | 28 | def apply_patches(filename): 29 | command = "patch" + " " + target_dir + filename + " < " + patch_dir + filename + ".patch" 30 | os.system(command) 31 | 32 | def print_usage(): 33 | print("Usage: make_patches.py [diff|patches]") 34 | print(" option diff generates patch files and stores them in directory patch") 35 | print(" option patch applies the patches to the code") 36 | 37 | if __name__ == "__main__": 38 | if len(sys.argv) != 2 or (len(sys.argv) == 2 and not (sys.argv[1] == "diff" or sys.argv[1] == "patch")): 39 | print_usage() 40 | exit() 41 | 42 | if len(sys.argv) > 1 and sys.argv[1] == "diff": 43 | if not os.path.exists(patch_dir): 44 | os.makedirs(patch_dir) 45 | for file in files: 46 | make_patches(file) 47 | 48 | if len(sys.argv) > 1 and sys.argv[1] == "patch": 49 | for file in files: 50 | apply_patches(file) 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/omuse/community/cdo/patches/EOFs.c.patch: -------------------------------------------------------------------------------- 1 | --- cdo-1.7.0rc5/src/EOFs.c 2015-03-26 08:40:12.000000000 +0100 2 | +++ src_original/src/EOFs.c 2017-02-08 13:32:40.486516982 +0100 3 | @@ -378,7 +378,7 @@ 4 | npack = 0; 5 | for ( i = 0; i < gridsize; ++i ) 6 | { 7 | - if ( !DBL_IS_EQUAL(weight[i], 0) && !DBL_IS_EQUAL(weight[i], missval) && 8 | + if ( !DBL_IS_EQUAL(weight[i], 0.) && !DBL_IS_EQUAL(weight[i], missval) && 9 | !DBL_IS_EQUAL(in[i], missval) ) 10 | pack[npack++] = i; 11 | } 12 | @@ -393,7 +393,7 @@ 13 | ipack = 0; 14 | for ( i = 0; i < gridsize; ++i ) 15 | { 16 | - if ( !DBL_IS_EQUAL(weight[i], 0) && !DBL_IS_EQUAL(weight[i], missval) && 17 | + if ( !DBL_IS_EQUAL(weight[i], 0.) && !DBL_IS_EQUAL(weight[i], missval) && 18 | !DBL_IS_EQUAL(in[i], missval) && pack[ipack++] != i ) 19 | { 20 | cdoAbort("Missing values unsupported!"); 21 | -------------------------------------------------------------------------------- /src/omuse/community/cdo/patches/Makefile.patch: -------------------------------------------------------------------------------- 1 | --- cdo-1.7.0rc5/src/Makefile 2017-02-08 13:18:05.883553560 +0100 2 | +++ src_original/src/Makefile 2016-12-14 21:29:52.949609436 +0100 3 | @@ -774,6 +774,22 @@ 4 | @rm -f cdo$(EXEEXT) 5 | $(AM_V_CCLD)$(cdo_LINK) $(cdo_OBJECTS) $(cdo_LDADD) $(LIBS) 6 | 7 | +############################################################# 8 | +#inserts by Ben van Werkhoven 9 | +############################################################# 10 | +MAIN_OBJ = cdo-cdo.$(OBJEXT) 11 | +AMUSE_OBJS = $(filter-out $(MAIN_OBJ),$(cdo_OBJECTS)) 12 | + 13 | +libcdo-cdolib.a: 14 | + echo "Building CDO library for AMUSE" 15 | + ar ruv libcdo-cdolib.a $(AMUSE_OBJS) 16 | + ranlib libcdo-cdolib.a 17 | + 18 | + 19 | +############################################################# 20 | +#end of inserts by Ben 21 | +############################################################# 22 | + 23 | cdotest$(EXEEXT): $(cdotest_OBJECTS) $(cdotest_DEPENDENCIES) $(EXTRA_cdotest_DEPENDENCIES) 24 | @rm -f cdotest$(EXEEXT) 25 | $(AM_V_CCLD)$(cdotest_LINK) $(cdotest_OBJECTS) $(cdotest_LDADD) $(LIBS) 26 | -------------------------------------------------------------------------------- /src/omuse/community/cdo/patches/remap_conserv_scrip.c.patch: -------------------------------------------------------------------------------- 1 | --- cdo-1.7.0rc5/src/remap_conserv_scrip.c 2015-01-20 15:38:15.000000000 +0100 2 | +++ src_original/src/remap_conserv_scrip.c 2016-12-14 21:29:52.961609434 +0100 3 | @@ -1223,7 +1223,7 @@ 4 | { 5 | /* local variables */ 6 | 7 | - int lcheck = TRUE; 8 | + int lcheck = FALSE; 9 | 10 | long ioffset; 11 | long max_subseg = 100000; /* max number of subsegments per segment to prevent infinite loop */ 12 | -------------------------------------------------------------------------------- /src/omuse/community/cdo/patches/remap_scrip_io.c.patch: -------------------------------------------------------------------------------- 1 | --- cdo-1.7.0rc5/src/remap_scrip_io.c 2015-06-19 14:46:34.000000000 +0200 2 | +++ src_original/src/remap_scrip_io.c 2016-12-14 21:29:52.955609437 +0100 3 | @@ -628,7 +628,7 @@ 4 | src_grid->gridID = gridID1; 5 | tgt_grid->gridID = gridID2; 6 | 7 | - if ( gridInqType(gridID1) == GRID_GME ) 8 | + if ( gridID1 != -1 && gridInqType(gridID1) == GRID_GME ) 9 | { 10 | src_grid->nvgp = gridInqSize(gridID1); 11 | gridID1_gme_c = gridToUnstructured(gridID1, 1); 12 | @@ -637,7 +637,7 @@ 13 | remapGridRealloc(rv->map_type, src_grid); 14 | remapGridRealloc(rv->map_type, tgt_grid); 15 | 16 | - if ( gridInqType(gridID1) == GRID_GME ) gridInqMaskGME(gridID1_gme_c, src_grid->vgpm); 17 | + if ( gridID1 != -1 && gridInqType(gridID1) == GRID_GME ) gridInqMaskGME(gridID1_gme_c, src_grid->vgpm); 18 | 19 | rv->pinit = TRUE; 20 | rv->wts = NULL; 21 | -------------------------------------------------------------------------------- /src/omuse/community/cdo/script.ar: -------------------------------------------------------------------------------- 1 | CREATE libcdo-amuse.a 2 | ADDLIB libcdo-cdolib.a 3 | ADDLIB .libs/libcdo.a 4 | SAVE 5 | END 6 | -------------------------------------------------------------------------------- /src/omuse/community/cdo/spherical_geometry.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from math import * 3 | 4 | #radius of Earth in meters 5 | R = 6371000 6 | 7 | #returns the spherical distance between two coordinates in given in lat,lon 8 | #result should be multiplied by R for the actual distance in meters 9 | def distance(lat1, lon1, lat2, lon2): 10 | dlat = lat2-lat1 11 | dlon = lon2-lon1 12 | 13 | #using haversine formula 14 | a = sin(dlat/2.0) * sin(dlat/2.0) + \ 15 | cos(lat1) * cos(lat2) * \ 16 | sin(dlon/2.0) * sin(dlon/2) 17 | 18 | d = 2 * atan2(sqrt(a), sqrt(1.0-a)) 19 | 20 | return d 21 | 22 | #returns the area of the triangle enclosed by three lines of distances a, b, and c 23 | #result should be multiplied with R**2 for the actual surface area in meters 24 | def triangle_area(a, b, c): 25 | #compute the semiperimeter 26 | s = (a + b + c)/2 27 | 28 | #compute spherical excess using L'Huilier's Theorem 29 | tans = tan(s/2) 30 | tana = tan((s-a)/2) 31 | tanb = tan((s-b)/2) 32 | tanc = tan((s-c)/2) 33 | 34 | tanE4 = sqrt(tans * tana * tanb * tanc) 35 | 36 | E = 4 * atan(tanE4) 37 | 38 | return E 39 | 40 | 41 | def triangle_area_points(lon1, lat1, lon2, lat2, lon3, lat3): 42 | a = distance(lat1, lon1, lat2, lon2) 43 | b = distance(lat2, lon2, lat3, lon3) 44 | c = distance(lat3, lon3, lat1, lon1) 45 | return triangle_area(a, b, c) 46 | -------------------------------------------------------------------------------- /src/omuse/community/cdo/test/test_CDOInterface.py: -------------------------------------------------------------------------------- 1 | from amuse.community import * 2 | from amuse.test.amusetest import TestWithMPI 3 | 4 | from omuse.community.cdo.interface import CDOInterface 5 | 6 | from amuse.units import units 7 | 8 | from nose.tools import nottest 9 | 10 | default_options=dict(redirection="none", channel="sockets") 11 | 12 | class CDOInterfaceTests(TestWithMPI): 13 | 14 | def test1(self): 15 | instance = CDOInterface(**default_options) 16 | print instance 17 | instance.stop() 18 | 19 | 20 | #test initialization through weights file 21 | def test2(self): 22 | instance = CDOInterface(**default_options) 23 | instance.initialize_code() 24 | filename = "weights/src_dst_con.nc" 25 | instance.set_weights_file(filename) 26 | instance.commit_parameters() 27 | get_file = instance.get_weights_file()['filename'] 28 | 29 | self.assertEquals(get_file, filename) 30 | 31 | self.assertEquals(instance.get_src_grid_size()['size'], 16200) 32 | instance.stop() 33 | 34 | 35 | #test initialization through grid files 36 | def test3(self): 37 | instance = CDOInterface(**default_options) 38 | instance.initialize_code() 39 | src_grid_file = "grids/src_grid.nc" 40 | dst_grid_file = "grids/dst_grid.nc" 41 | instance.set_src_grid_file(src_grid_file) 42 | instance.set_dst_grid_file(dst_grid_file) 43 | instance.commit_parameters() 44 | get_file = instance.get_src_grid_file()['filename'] 45 | self.assertEquals(get_file, src_grid_file) 46 | get_file = instance.get_dst_grid_file()['filename'] 47 | self.assertEquals(get_file, dst_grid_file) 48 | 49 | self.assertEquals(instance.get_src_grid_size()['size'], 16200) 50 | self.assertEquals(instance.get_dst_grid_size()['size'], 18048) 51 | instance.stop() 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/omuse/community/cdo/test/test_CDORemapper.py: -------------------------------------------------------------------------------- 1 | from amuse.community import * 2 | from amuse.test.amusetest import TestWithMPI 3 | 4 | from omuse.community.cdo.interface import CDORemapper 5 | 6 | from amuse.units import units 7 | 8 | from nose.tools import nottest 9 | 10 | default_options=dict(redirection="none", channel="sockets") 11 | 12 | class CDORemapperTests(TestWithMPI): 13 | def test1(self): 14 | r = CDORemapper(**default_options) 15 | print(r) 16 | r.stop() 17 | 18 | 19 | #test initialization through weights file and check state 20 | def test2(self): 21 | r = CDORemapper(**default_options) 22 | self.assertEquals(r.state_machine._current_state.name, 'UNINITIALIZED') 23 | 24 | filename = "weights/src_dst_con.nc" 25 | r.parameters.weights_file = filename 26 | self.assertEquals(r.state_machine._current_state.name, 'INITIALIZED') 27 | 28 | get_file = r.parameters.weights_file 29 | self.assertEquals(get_file, filename) 30 | 31 | src_grid_size = r.get_src_grid_size() 32 | self.assertEquals(src_grid_size, 16200) 33 | self.assertEquals(r.state_machine._current_state.name, 'RUN') 34 | 35 | r.stop() 36 | -------------------------------------------------------------------------------- /src/omuse/community/cdo/view_adcirc_grid.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | 4 | from omuse.community.adcirc.read_grid import adcirc_grid_reader 5 | import numpy 6 | from matplotlib import pyplot 7 | 8 | class adcirc_grid_viewer(): 9 | 10 | def __init__(self, filename, coordinates): 11 | r = self.r = adcirc_grid_reader(filename, coordinates) 12 | r.read_grid() 13 | 14 | # r.p contains the lines of node definitions, strip last column 15 | self.x = r.p[:,0] 16 | self.y = r.p[:,1] 17 | 18 | # r.t contains the connectivity of nodes to form triangles, strip fist column 19 | self.triangles = r.t[:,1:] -1 20 | 21 | def plot(self): 22 | pyplot.triplot(self.x, self.y, self.triangles, 'k-') 23 | pyplot.show() 24 | 25 | 26 | if __name__ == "__main__": 27 | import sys 28 | import os.path 29 | 30 | usage_str = "Usage: view_adcirc_grid.py filename coordinates=[spherical|cartesian]" 31 | 32 | total = len(sys.argv) 33 | if len(sys.argv) != 3: 34 | sys.exit(usage_str) 35 | 36 | filename = sys.argv[1] 37 | if not os.path.isfile(filename): 38 | sys.exit("Error: No such file " + filename) 39 | 40 | coordinates = sys.argv[2] 41 | if not (coordinates == 'spherical' or coordinates == 'cartesian'): 42 | sys.exit(usage_str) 43 | 44 | v = adcirc_grid_viewer(filename, coordinates) 45 | 46 | v.plot() 47 | 48 | raw_input() 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/omuse/community/cdo/view_grid.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import numpy 4 | import sys 5 | import os.path 6 | 7 | total = len(sys.argv) 8 | if len(sys.argv) != 2: 9 | sys.exit("Usage: view_grid.py filename") 10 | 11 | filename = sys.argv[1] 12 | if not os.path.isfile(filename): 13 | sys.exit("Error: No such file " + filename) 14 | 15 | 16 | from netCDF4 import Dataset 17 | fh = Dataset(filename, mode='r') 18 | 19 | ny = fh.variables['grid_dims'][0] 20 | nx = fh.variables['grid_dims'][1] 21 | 22 | latitudes = fh.variables['grid_center_lat'][:] 23 | longitudes = fh.variables['grid_center_lon'][:] 24 | imask = fh.variables['grid_imask'][:] 25 | 26 | lats = latitudes.__array__().reshape(nx,ny) 27 | lons = longitudes.__array__().reshape(nx,ny) 28 | mask = imask.__array__().reshape(nx,ny) 29 | 30 | import matplotlib.pyplot as pyplot 31 | 32 | f, ((ax1, ax2), (ax3, ax4)) = pyplot.subplots(nrows=2, ncols=2, sharex=True, sharey=True) 33 | ax1.set_adjustable('box-forced') 34 | ax2.set_adjustable('box-forced') 35 | ax3.set_adjustable('box-forced') 36 | ax4.set_adjustable('box-forced') 37 | 38 | #print lats[::-1,:] 39 | ax1.imshow(lats[::-1,:], cmap=pyplot.cm.jet) 40 | 41 | #print lons[::-1,:] 42 | ax2.imshow(lons[::-1,:], cmap=pyplot.cm.jet) 43 | 44 | #print mask[::-1,:] 45 | ax3.imshow(mask[::-1,:], cmap=pyplot.cm.bone) 46 | 47 | if 'grid_area' in fh.variables: 48 | ax4.imshow(fh.variables['grid_area'][:].reshape(nx,ny)[::-1,:], cmap=pyplot.cm.jet) 49 | else: 50 | ax4.imshow((numpy.zeros(nx*ny)).reshape(nx,ny), cmap=pyplot.cm.bone) 51 | 52 | 53 | 54 | from mpl_toolkits.mplot3d import axes3d 55 | import numpy 56 | 57 | lon = lons 58 | lat = lats 59 | 60 | #print min(lon.flatten()), max(lon.flatten()) 61 | 62 | if (fh.variables['grid_center_lon'].units == "degrees"): 63 | lon = lon/180*numpy.pi 64 | if (fh.variables['grid_center_lat'].units == "degrees"): 65 | lat = lat/180*numpy.pi 66 | 67 | #compute convenient strides, designed to go up for high resolution grids, 68 | #but not so fast that low resolution grids look poorly 69 | rstride = int(numpy.rint((2*nx/48 + numpy.sqrt(nx))/3)) 70 | cstride = int(numpy.rint((2*ny/60 + numpy.sqrt(ny))/3)) 71 | 72 | f=pyplot.figure(2) 73 | ax = f.add_subplot(111, projection='3d') 74 | X = numpy.cos(lat)*numpy.cos(lon) 75 | Y = numpy.cos(lat)*numpy.sin(lon) 76 | Z = numpy.sin(lat) 77 | ax.plot_surface(X, Y, Z, color='white', rstride=rstride, cstride=cstride, shade=True) 78 | 79 | 80 | 81 | 82 | pyplot.ion() 83 | pyplot.show() 84 | 85 | raw_input() 86 | -------------------------------------------------------------------------------- /src/omuse/community/cdo/weights/src_dst_con.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/cdo/weights/src_dst_con.nc -------------------------------------------------------------------------------- /src/omuse/community/dales/README: -------------------------------------------------------------------------------- 1 | This is the omuse-wrapper for the Dutch Atmospheric Large Eddy Simulation (DALES). 2 | -------------------------------------------------------------------------------- /src/omuse/community/dales/__init__.py: -------------------------------------------------------------------------------- 1 | # relative import hack 2 | # https://stackoverflow.com/questions/16981921/relative-imports-in-python-3 3 | import os, sys; sys.path.append(os.path.dirname(os.path.realpath(__file__))) 4 | -------------------------------------------------------------------------------- /src/omuse/community/dales/example/bubble.py: -------------------------------------------------------------------------------- 1 | """ 2 | A warm air bubble experiment using the DALES Python interface 3 | 4 | This script performs the following steps: 5 | * create a Dales object 6 | * set parameters 7 | * create an initial state with a warm air bubble on a constant liquid-water-potential temperature (thl) background 8 | * perform time evolution 9 | * plot a time series of the model using matplotlib. 10 | 11 | """ 12 | 13 | import numpy 14 | import matplotlib.pyplot as plt 15 | from omuse.community.dales.interface import Dales 16 | from omuse.units import units 17 | 18 | # create Dales object 19 | d=Dales(workdir='daleswork', channel_type='sockets', number_of_workers=1) 20 | # add redirection='none' to see the model log messages 21 | 22 | # Set parameters: domain size and resolution, advection scheme 23 | d.parameters_DOMAIN.itot = 32 # number of grid cells in x 24 | d.parameters_DOMAIN.jtot = 32 # number of grid cells in y 25 | d.parameters_DOMAIN.xsize = 6400 | units.m 26 | d.parameters_DOMAIN.ysize = 6400 | units.m 27 | d.parameters_DYNAMICS.iadv_mom = 6 # 6th order advection for momentum 28 | d.parameters_DYNAMICS.iadv_thl = 5 # 5th order advection for temperature 29 | d.parameters_RUN.krand = 0 # initial state randomization off 30 | 31 | d.parameters_RUN.ladaptive = True 32 | d.parameters_RUN.courant = 0.5 33 | d.parameters_RUN.peclet = 0.1 34 | 35 | d.parameters_PHYSICS.lcoriol = False 36 | d.parameters_PHYSICS.igrw_damp = 3 37 | 38 | # initialize all velocities to 0 and a low spec. humidity 39 | d.fields[:,:,:].U = 0 | units.m / units.s 40 | d.fields[:,:,:].V = 0 | units.m / units.s 41 | d.fields[:,:,:].W = 0 | units.m / units.s 42 | d.fields[:,:,:].QT = 0.001 | units.kg / units.kg 43 | 44 | # add perturbation in temperature - Gaussian bubble at (cx,cy,cz), radius r 45 | cx,cy,cz,r = 3200|units.m, 3200|units.m, 500|units.m, 500|units.m 46 | d.fields[:,:,:].THL += (0.5 | units.K) * numpy.exp( 47 | -((d.fields.x-cx)**2 + (d.fields.y-cy)**2 + (d.fields.z-cz)**2)/(2*r**2)) 48 | 49 | times = numpy.linspace(0, 44, 12) | units.minute # times for snapshots 50 | fig, axes = plt.subplots(3, 4, sharex=True, sharey=True) 51 | extent = (0, d.fields.y[0,-1,0].value_in(units.m), 52 | 0, d.fields.z[0,0,-1].value_in(units.m)) 53 | for t,ax in zip(times, axes.flatten()): 54 | print('Evolving to', t) 55 | d.evolve_model(t) 56 | im = ax.imshow(d.fields[16,:,:].THL.value_in(units.K).transpose(), 57 | extent=extent, origin='lower', vmin=292.5, vmax=292.75) 58 | ax.text(.1, .1, str(t.in_(units.minute)), 59 | color='w', transform=ax.transAxes) 60 | plt.show() 61 | -------------------------------------------------------------------------------- /src/omuse/community/dales/test/README.md: -------------------------------------------------------------------------------- 1 | ### DALES python wrapper test suite 2 | 3 | * To run the test suite type `nosetests -v` within this directory (using your python environment where OMUSE is installed) 4 | * To test the dales low-level fortran interface to OMUSE, run the `run_dales` binary for an appropriate test case (see `dales-repo/cases`) -------------------------------------------------------------------------------- /src/omuse/community/dales/test/run_dales.f90: -------------------------------------------------------------------------------- 1 | program fortran_test 2 | 3 | use dales_interface 4 | 5 | implicit none 6 | 7 | integer :: stat, nargs 8 | real(8) :: tend, walltime 9 | character(len=256) :: case, rundir 10 | stat=0 11 | 12 | nargs = command_argument_count() 13 | if(nargs==0) then 14 | stop "Please provide a case argument (bomex/rico/sp-testcase/...)" 15 | end if 16 | call get_command_argument(1, case) 17 | rundir="../dales-repo/cases/"//case 18 | stat = change_dir(rundir) 19 | if(stat/=0) then 20 | stop "...failed, stopping." 21 | else 22 | write(*,*) "..success." 23 | endif 24 | 25 | write(*,*) "Initializing fortran interface code..." 26 | stat=initialize_code() 27 | if(stat/=0) then 28 | stop "...failed, stopping." 29 | else 30 | write(*,*) "..success." 31 | endif 32 | 33 | write(*,*) "Initializing model..." 34 | stat=commit_parameters() 35 | if(stat/=0) then 36 | stop "...failed, stopping." 37 | else 38 | write(*,*) "..success." 39 | endif 40 | 41 | write(*,*) "Running for a minute..." 42 | tend=60 43 | stat=evolve_model(tend, 0, walltime) 44 | if(stat/=0) then 45 | stop "...failed, stopping." 46 | else 47 | write(*,*) "...success." 48 | endif 49 | 50 | write(*,*) "Exiting fortran interface code..." 51 | stat=cleanup_code() 52 | if(stat/=0) then 53 | stop "...failed, stopping." 54 | else 55 | write(*,*) "..success." 56 | endif 57 | 58 | end program 59 | 60 | -------------------------------------------------------------------------------- /src/omuse/community/era5/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/era5/__init__.py -------------------------------------------------------------------------------- /src/omuse/community/era5/doc/era5.rst: -------------------------------------------------------------------------------- 1 | ERA5 interface 2 | ============== 3 | 4 | Using the OMUSE interface to ERA5 you can access the CDS ERA5 dataset in a 5 | code-like manner. The ``ERA5`` class has a model interface 6 | with a ``evolve_model`` method which handles the download and caching of 7 | ERA5 data in a transparent fashion. 8 | 9 | Variables 10 | --------- 11 | 12 | Currently the ERA5 interface exposes single level variables from ERA5_. 13 | Variables are available on standard OMUSE ``grid`` object. 14 | 15 | Prerequisites 16 | ------------- 17 | 18 | ``ERA5`` needs the CDSAPI_ installed as well as a valid 19 | access key in `` ~/.cdsapirc`` 20 | 21 | Example 22 | ------- 23 | 24 | example:: 25 | 26 | from omuse.units import units 27 | from omuse.community.era5.interface import ERA5 28 | 29 | e=ERA5(variables=["2m_temperature", "total_precipitation"], 30 | nwse_boundingbox=[70, -15, 40, 15]| units.deg) 31 | 32 | print("starting date:", e.start_datetime) 33 | print(e.grid) # note grid has prepended the names with _ (because ERA5 variable names are not always valid python var names) 34 | 35 | e.evolve_model(128 | units.hour) 36 | val=e.grid._2m_temperature.value_in(units.K) 37 | 38 | .. autoclass:: omuse.community.era5.interface.ERA5 39 | :members: 40 | 41 | .. _ERA5: https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation 42 | .. _CDSAPI: https://pypi.org/project/cdsapi/ 43 | -------------------------------------------------------------------------------- /src/omuse/community/era5/example.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | import matplotlib 4 | matplotlib.use("TkAgg") # select appropiate backend 5 | from matplotlib import pyplot 6 | 7 | from omuse.units import units 8 | 9 | from omuse.community.era5.interface import ERA5 10 | 11 | e=ERA5(variables=["2m_temperature", "total_precipitation"], 12 | nwse_boundingbox=[70, -15, 40, 15]| units.deg) 13 | 14 | print("starting date:", e.start_datetime) 15 | print(e.grid) # note grid has prepended the names with _ (because long names are not valid python var names) 16 | 17 | f=pyplot.figure(figsize=(8,8)) 18 | pyplot.ion() 19 | pyplot.show() 20 | 21 | dt=1. | units.hour 22 | tend=7. | units.day 23 | 24 | while e.model_time < tend: 25 | print("tnow:",e.model_time) 26 | e.evolve_model(e.model_time+dt) 27 | val=e.grid._2m_temperature.value_in(units.K) 28 | val=0.25*(val[:-1,:-1]+val[1:,:-1]+val[:-1,1:]+val[1:,1:]) 29 | x=e.grid.lon.value_in(units.deg) 30 | y=e.grid.lat.value_in(units.deg) 31 | 32 | pyplot.clf() 33 | pyplot.pcolormesh(x,y,val,vmin=260,vmax=288) 34 | pyplot.xlabel("lon (deg)") 35 | pyplot.ylabel("lat (deg)") 36 | f.canvas.flush_events() 37 | 38 | time.sleep(1/20.) 39 | -------------------------------------------------------------------------------- /src/omuse/community/era5/test_era5.py: -------------------------------------------------------------------------------- 1 | # todo: 2 | # test all units are defined 3 | # test all shortnames are defined 4 | # test instantiation 5 | # test basic functionality 6 | 7 | import os 8 | import sys 9 | import numpy 10 | 11 | from omuse.units import units 12 | 13 | from amuse.test.amusetest import TestWithMPI 14 | 15 | from omuse.community.era5 import era5 16 | from omuse.community.era5.interface import ERA5, _era5_units_to_omuse 17 | 18 | import datetime 19 | 20 | class testera5(TestWithMPI): 21 | def test0(self): 22 | """ test single level units""" 23 | for field in era5.SLVARS: 24 | ustring=era5.UNITS[field] 25 | if ustring not in _era5_units_to_omuse: 26 | print("%s unit unknown"%ustring) 27 | 28 | class TestERA5(TestWithMPI): 29 | 30 | def test0(self): 31 | instance=ERA5() 32 | -------------------------------------------------------------------------------- /src/omuse/community/iemic/__init__.py: -------------------------------------------------------------------------------- 1 | # relative import hack 2 | # https://stackoverflow.com/questions/16981921/relative-imports-in-python-3 3 | import os, sys; sys.path.append(os.path.dirname(os.path.realpath(__file__))) 4 | -------------------------------------------------------------------------------- /src/omuse/community/iemic/mkmask/mask_natl8: -------------------------------------------------------------------------------- 1 | level = 0 _________________________ 2 | 1111111111 3 | 1111111111 4 | 1111111111 5 | 1111111111 6 | 1111111111 7 | 1111111111 8 | 1111111111 9 | 1111111111 10 | 1111111111 11 | 1111111111 12 | level = 1 _________________________ 13 | 1111111111 14 | 1111111001 15 | 1000110001 16 | 1000000001 17 | 1000000001 18 | 1000000001 19 | 1100000011 20 | 1100000011 21 | 1110000111 22 | 1111111111 23 | level = 2 _________________________ 24 | 1111111111 25 | 1111111001 26 | 1000110001 27 | 1000000001 28 | 1000000001 29 | 1000000001 30 | 1100000011 31 | 1100000011 32 | 1110000111 33 | 1111111111 34 | level = 3 _________________________ 35 | 1111111111 36 | 1111111001 37 | 1000110001 38 | 1000000001 39 | 1000000001 40 | 1000000001 41 | 1100000011 42 | 1100000011 43 | 1110000111 44 | 1111111111 45 | level = 4 _________________________ 46 | 1111111111 47 | 1111111001 48 | 1000110001 49 | 1000000001 50 | 1000000001 51 | 1000000001 52 | 1100000011 53 | 1100000011 54 | 1110000111 55 | 1111111111 56 | level = 5 _________________________ 57 | 1111111111 58 | 1111111111 59 | 1111111111 60 | 1111111111 61 | 1111111111 62 | 1111111111 63 | 1111111111 64 | 1111111111 65 | 1111111111 66 | 1111111111 -------------------------------------------------------------------------------- /src/omuse/community/iemic/mkmask/mask_test: -------------------------------------------------------------------------------- 1 | level = 0 _________________________ 2 | 1111111111 3 | 1111111111 4 | 1111111111 5 | 1111111111 6 | 1111111111 7 | 1111111111 8 | 1111111111 9 | 1111111111 10 | 1111111111 11 | 1111111111 12 | level = 1 _________________________ 13 | 1111111111 14 | 1111111001 15 | 3000110003 16 | 3000000003 17 | 3000000003 18 | 3000000003 19 | 1100000011 20 | 1100000011 21 | 1110000111 22 | 1111111111 23 | level = 2 _________________________ 24 | 1111111111 25 | 1111111001 26 | 3000110003 27 | 3000000003 28 | 3000000003 29 | 3000000003 30 | 1100000011 31 | 1100000011 32 | 1110000111 33 | 1111111111 34 | level = 3 _________________________ 35 | 1111111111 36 | 1111111001 37 | 3000110003 38 | 3000000003 39 | 3000000003 40 | 3000000003 41 | 1100000011 42 | 1100000011 43 | 1110000111 44 | 1111111111 45 | level = 4 _________________________ 46 | 1111111111 47 | 1111111001 48 | 3000110003 49 | 3000000003 50 | 3000000003 51 | 3000000003 52 | 1100000011 53 | 1100000011 54 | 1110000111 55 | 1111111111 56 | level = 5 _________________________ 57 | 1111111111 58 | 1111111111 59 | 1111111111 60 | 1111111111 61 | 1111111111 62 | 1111111111 63 | 1111111111 64 | 1111111111 65 | 1111111111 66 | 1111111111 -------------------------------------------------------------------------------- /src/omuse/community/iemic/remotestatevector.py: -------------------------------------------------------------------------------- 1 | from amuse.support.exceptions import CodeException 2 | 3 | class RemoteStateVector(object): 4 | def __init__(self, interface): 5 | self.interface=interface 6 | self._id=interface._new_state() 7 | self.grid=interface.get_state_grid(self) 8 | def copy_to(self, state): 9 | self.interface._copy_state(self._id, state._id) 10 | def copy(self): 11 | new=RemoteStateVector(self.interface) 12 | self.copy_to(new) 13 | return new 14 | def norm(self): 15 | return self.interface._get_state_norm(self._id) 16 | def length(self): 17 | return self.interface._length(self._id) 18 | def dot(self, other): 19 | return self.interface._dot(self._id, other._id) 20 | def __del__(self): 21 | try: 22 | self.interface._remove_state(self._id) 23 | except CodeException: 24 | pass 25 | except AttributeError: 26 | pass 27 | def __mul__(self, other): 28 | new=self.copy() 29 | self.interface._mul_state(new._id, other) 30 | return new 31 | def __rmul__(self, other): 32 | return self.__mul__(other) 33 | def __truediv__(self, other): 34 | return self.__mul__(1./other) 35 | def __add__(self, other): 36 | new = self.copy() 37 | self.interface._update_state(new._id, other._id, 1.0) 38 | return new 39 | def __sub__(self, other): 40 | new = self.copy() 41 | self.interface._update_state(new._id, other._id, -1.0) 42 | return new 43 | def __neg__(self): 44 | new = self.copy() 45 | self.interface._mul_state(new._id, -1.0) 46 | return new 47 | def __getitem__(self, index): 48 | return self.grid[index] 49 | def __str__(self): 50 | return self.interface._to_str(self._id) 51 | @property 52 | def size(self): 53 | return self.interface._length(self._id) 54 | @property 55 | def shape(self): 56 | return [self.size] 57 | -------------------------------------------------------------------------------- /src/omuse/community/iemic/setup.cfg: -------------------------------------------------------------------------------- 1 | [nosetests] 2 | processes=0 3 | process-timeout=120 4 | -------------------------------------------------------------------------------- /src/omuse/community/oifs/Makefile.lisa: -------------------------------------------------------------------------------- 1 | # standard amuse configuration include 2 | # config.mk will be made after ./configure has run 3 | AMUSE_DIR?=../../../.. 4 | -include $(AMUSE_DIR)/config.mk 5 | 6 | MPIFC ?= mpif90 7 | 8 | #FCFLAGS += -fopenmp -DBLAS -DLINUX -DINTEGER_IS_INT -DF90 -DPARAL -DNONCRAYF -m64 -fconvert=big-endian 9 | #FCFLAGS += -DBLAS -DLINUX -DINTEGER_IS_INT -DF90 -DPARAL -DNONCRAYF -m64 -fconvert=big-endian 10 | # NOTE -fconvert=big-endian is specific to GNU 11 | # We don't want openMP at the moment - it doesn't work 12 | 13 | 14 | LDFLAGS += -lm $(AMUSE_LD_FLAGS) 15 | 16 | OIFS_GRIB_API_DIR ?= /usr/local/ 17 | export OIFS_GRIB_API_DIR 18 | export OIFS_GRIB_API_LIB = -L$(OIFS_GRIB_API_DIR)/lib -lgrib_api_f90 -lgrib_api 19 | #export OIFS_LAPACK_LIB = -L/usr/lib -llapack -lblas # this - or the FCFLAGS - break intel compile 20 | 21 | FS_LIBS += -L$(OIFS_GRIB_API_DIR)/lib -lgrib_api_f90 -lgrib_api -llapack -lblas 22 | 23 | OIFSDIR=oifslib 24 | 25 | CODE_GENERATOR = $(AMUSE_DIR)/build.py 26 | 27 | #export OIFS_BUILD=noopt 28 | export OIFS_BUILD=nomp 29 | 30 | #some optimization, but not openMP 31 | 32 | # choose compiler 33 | ifeq ($(FC),ifort) 34 | export OIFS_COMP=intel 35 | FCFLAGS += -convert big_endian 36 | else 37 | export OIFS_COMP=gnu 38 | endif 39 | 40 | 41 | 42 | 43 | 44 | 45 | all: oifslib oifssrc openifs_worker 46 | 47 | update: oifslib 48 | cd $(OIFSDIR); git pull 49 | 50 | oifslib: 51 | git clone -b oifslib https://software.ecmwf.int/stash/scm/~g.vandenoord_esciencecenter.nl/oifs40r1-lib.git $(OIFSDIR) 52 | 53 | oifssrc: 54 | ./$(OIFSDIR)/fcm/bin/fcm make -v -j4 -f $(OIFSDIR)/make/oifslib.cfg 55 | mkdir -p $(OIFSDIR)/make/$(OIFS_COMP)-$(OIFS_BUILD)/oifs/lib 56 | ar rcs $(OIFSDIR)/make/$(OIFS_COMP)-$(OIFS_BUILD)/oifs/lib/liboifs.a $(OIFSDIR)/make/$(OIFS_COMP)-$(OIFS_BUILD)/oifs/o/*.o 57 | 58 | worker_code.f90: interface.py 59 | $(CODE_GENERATOR) --type=f90 interface.py OpenIFSInterface -o $@ 60 | 61 | openifs_worker: worker_code.f90 $(OBJS) interface.f90 oifssrc 62 | $(MPIFC) $(FCFLAGS) -O2 -xHost -g -I$(OIFSDIR)/make/$(OIFS_COMP)-$(OIFS_BUILD)/oifs/include -c interface.f90 -o interface.o 63 | $(MPIFC) $(FCFLAGS) -O2 -xHost -g -I$(OIFSDIR)/make/$(OIFS_COMP)-$(OIFS_BUILD)/oifs/include $(SC_FLAGS) $(FS_FLAGS) $< interface.o $(OIFSDIR)/make/$(OIFS_COMP)-$(OIFS_BUILD)/oifs/lib/liboifs.a $(FS_LIBS) $(SC_FCLIBS) -o $@ 64 | 65 | #TODO: Clean oifs directory 66 | clean: 67 | $(RM) -f *.so *.o *.pyc worker_code.cc worker_code.h *.mod 68 | $(RM) *~ worker_code worker_code.f90 69 | rm -f oifs_worker_* 70 | rm oifslib/make/$(OIFS_COMP)-$(OIFS_BUILD) -rf 71 | 72 | distclean: clean 73 | rm -rf $(OIFSDIR) 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/omuse/community/oifs/README: -------------------------------------------------------------------------------- 1 | This is the OMUSE interface to the global circulation model OpenIFS. 2 | -------------------------------------------------------------------------------- /src/omuse/community/oifs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/__init__.py -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ICMGGTESTINIT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ICMGGTESTINIT -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ICMGGTESTINIUA: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ICMGGTESTINIUA -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ICMSHTESTINIT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ICMSHTESTINIT -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/example1D.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from amuse.community import * 4 | from omuse.community.oifs.interface import OpenIFS 5 | 6 | import numpy 7 | import matplotlib.pyplot as plot 8 | import matplotlib.animation as movie 9 | from mpl_toolkits.basemap import Basemap 10 | import os 11 | import sys 12 | import shutil 13 | 14 | oifs_procs = 1 15 | oifs = None 16 | 17 | def init(): 18 | global oifs 19 | oifs = OpenIFS(number_of_workers=oifs_procs,redirection="none") 20 | oifs.initialize_code() 21 | 22 | 23 | def plotmovie(frames,steps): 24 | size = oifs.itot 25 | x = oifs.longitudes.value_in(units.deg) 26 | y = oifs.latitudes.value_in(units.deg) 27 | fig = plot.figure() 28 | sp = fig.add_subplot(1,1,1) 29 | sp.set_xlabel("T(K)") 30 | sp.set_ylabel("z") 31 | height = numpy.arange(0,oifs.ktot) 32 | def update(i): 33 | t = oifs.get_model_time() 34 | oifs.evolve_model(t + (steps/frames)*oifs.get_timestep()) 35 | z = oifs.get_profile_field("T",oifs.itot/2).value_in(units.K) 36 | print z 37 | sp.plot(z,height) 38 | a = movie.FuncAnimation(fig,update,frames=frames,repeat=False) 39 | plot.show() 40 | 41 | 42 | def main(args): 43 | init() 44 | oifs.commit_parameters() 45 | tim=oifs.get_model_time() 46 | oifs.commit_grid() 47 | plotmovie(frames=10,steps=10.) 48 | oifs.cleanup_code() 49 | 50 | if __name__=="__main__": 51 | main(sys.argv[1:]) 52 | -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/example2D.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from amuse.community import * 4 | from omuse.community.oifs.interface import OpenIFS 5 | 6 | import numpy 7 | import matplotlib.pyplot as plot 8 | import matplotlib.animation as movie 9 | from mpl_toolkits.basemap import Basemap 10 | import os 11 | import sys 12 | import shutil 13 | 14 | oifs_procs = 4 15 | oifs = None 16 | 17 | def init(): 18 | global oifs 19 | oifs = OpenIFS(number_of_workers=oifs_procs,redirection="none") 20 | oifs.initialize_code() 21 | 22 | 23 | def plotmovie(frames,steps): 24 | size = oifs.itot 25 | x = oifs.longitudes.value_in(units.deg) 26 | y = oifs.latitudes.value_in(units.deg) 27 | fig = plot.figure() 28 | ax = fig.add_subplot(1,1,1) 29 | ax.set_xlabel("lon") 30 | ax.set_ylabel("lat") 31 | m = Basemap(lat_0=-90,lat_1=90,lon_0=180,resolution='c') 32 | m.drawcoastlines() 33 | def update(i): 34 | t = oifs.get_model_time() 35 | oifs.evolve_model(t + (steps/frames)*oifs.get_timestep()) 36 | z = oifs.get_layer_field("SH",oifs.ktot-1) 37 | plot.scatter(x,y,c = z,s = 150,cmap = plot.cm.coolwarm,edgecolors = "none") 38 | a = movie.FuncAnimation(fig,update,frames=frames,repeat=False) 39 | plot.show() 40 | 41 | 42 | def main(args): 43 | init() 44 | oifs.commit_parameters() 45 | tim=oifs.get_model_time() 46 | oifs.commit_grid() 47 | plotmovie(frames=10,steps=10.) 48 | oifs.cleanup_code() 49 | 50 | if __name__=="__main__": 51 | main(sys.argv[1:]) 52 | -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/C11CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/C11CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/C12CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/C12CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/C22CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/C22CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/CCL4CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/CCL4CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/CH4CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/CH4CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/CO2CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/CO2CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/ECOZC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/ECOZC -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/GCH4CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/GCH4CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/GCO2CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/GCO2CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/GOZOCLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/GOZOCLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/MCICA: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/MCICA -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/N2OCLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/N2OCLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/NO2CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/NO2CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/OZOCLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/OZOCLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/RADRRTM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/RADRRTM -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/RADSRTM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/RADSRTM -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_A1B2000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_A1B2000 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_A1B2010: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_A1B2010 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_A1B2020: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_A1B2020 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_A1B2030: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_A1B2030 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_A1B2040: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_A1B2040 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_A1B2050: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_A1B2050 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_A1B2060: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_A1B2060 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_A1B2070: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_A1B2070 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_A1B2080: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_A1B2080 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_A1B2090: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_A1B2090 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_A1B2100: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_A1B2100 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_OBS1920: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_OBS1920 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_OBS1930: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_OBS1930 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_OBS1940: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_OBS1940 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_OBS1950: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_OBS1950 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_OBS1960: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_OBS1960 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_OBS1970: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_OBS1970 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_OBS1980: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_OBS1980 -------------------------------------------------------------------------------- /src/omuse/community/oifs/examples/ifsdata/SO4_OBS1990: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/examples/ifsdata/SO4_OBS1990 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ICMGGTESTINIT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ICMGGTESTINIT -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ICMGGTESTINIUA: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ICMGGTESTINIUA -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ICMSHTESTINIT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ICMSHTESTINIT -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/C11CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/C11CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/C12CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/C12CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/C22CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/C22CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/CCL4CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/CCL4CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/CH4CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/CH4CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/CO2CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/CO2CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/ECOZC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/ECOZC -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/GCH4CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/GCH4CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/GCO2CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/GCO2CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/GOZOCLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/GOZOCLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/MCICA: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/MCICA -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/N2OCLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/N2OCLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/NO2CLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/NO2CLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/OZOCLIM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/OZOCLIM -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/RADRRTM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/RADRRTM -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/RADSRTM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/RADSRTM -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_A1B2000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_A1B2000 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_A1B2010: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_A1B2010 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_A1B2020: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_A1B2020 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_A1B2030: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_A1B2030 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_A1B2040: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_A1B2040 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_A1B2050: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_A1B2050 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_A1B2060: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_A1B2060 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_A1B2070: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_A1B2070 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_A1B2080: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_A1B2080 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_A1B2090: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_A1B2090 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_A1B2100: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_A1B2100 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_OBS1920: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_OBS1920 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_OBS1930: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_OBS1930 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_OBS1940: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_OBS1940 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_OBS1950: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_OBS1950 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_OBS1960: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_OBS1960 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_OBS1970: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_OBS1970 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_OBS1980: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_OBS1980 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/ifsdata/SO4_OBS1990: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/oifs/test/ifsdata/SO4_OBS1990 -------------------------------------------------------------------------------- /src/omuse/community/oifs/test/test_oifs.py: -------------------------------------------------------------------------------- 1 | from amuse.community import * 2 | from amuse.test.amusetest import TestWithMPI 3 | from omuse.community.oifs.interface import OpenIFSInterface 4 | from omuse.community.oifs.interface import OpenIFS 5 | 6 | import logging 7 | import nose.tools 8 | 9 | logging.basicConfig(level = logging.DEBUG) 10 | log = logging.getLogger(__name__) 11 | 12 | class TestOpenIFSInterface(TestWithMPI): 13 | 14 | def test_single_proc(self): 15 | log.info("Testing instantiate OpenIFS with single MPI rank and cleaning up") 16 | instance = OpenIFS() 17 | try: 18 | instance.initialize_code() 19 | instance.commit_grid() 20 | finally: 21 | instance.cleanup_code() 22 | instance.stop() 23 | 24 | def test_4proc(self): 25 | log.info("Testing instantiate OpenIFS with 4 MPI ranks and cleaning up") 26 | instance = OpenIFS(number_of_workers = 4) 27 | try: 28 | instance.initialize_code() 29 | instance.commit_grid() 30 | finally: 31 | instance.cleanup_code() 32 | instance.stop() 33 | 34 | def test_evolve_model(self): 35 | log.info("Testing running OpenIFS for one hour") 36 | instance = OpenIFS() 37 | try: 38 | instance.initialize_code() 39 | tim = instance.get_model_time() 40 | instance.commit_grid() 41 | instance.evolve_model(tim + (1 | units.hour)) 42 | newtim = instance.get_model_time() 43 | self.assertTrue(newtim >= tim) 44 | finally: 45 | instance.cleanup_code() 46 | instance.stop() 47 | 48 | def test_evolve_model_4proc(self): 49 | log.info("Testing running OpenIFS for eight hours with 4 MPI ranks") 50 | instance = OpenIFS(number_of_workers = 4) 51 | try: 52 | instance.initialize_code() 53 | tim = instance.get_model_time() 54 | instance.commit_grid() 55 | instance.evolve_model(tim + (8 | units.hour)) 56 | newtim = instance.get_model_time() 57 | self.assertTrue(newtim >= tim) 58 | finally: 59 | instance.cleanup_code() 60 | instance.stop() 61 | -------------------------------------------------------------------------------- /src/omuse/community/pop/.gitignore: -------------------------------------------------------------------------------- 1 | src_*/compile 2 | -------------------------------------------------------------------------------- /src/omuse/community/pop/__init__.py: -------------------------------------------------------------------------------- 1 | # generated file -------------------------------------------------------------------------------- /src/omuse/community/pop/_src_template/domain_size.F90: -------------------------------------------------------------------------------- 1 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 2 | 3 | module domain_size 4 | 5 | !BOP 6 | ! !MODULE: domain_size 7 | ! 8 | ! !DESCRIPTION: 9 | ! This module contains parameters for the global model domain size 10 | ! decomposition block size. It is used by the domain and block 11 | ! modules for decomposing the model domain across processors. 12 | ! Variables are now set in POP\_DomainSizeMod and this routine 13 | ! only provide back compatibility. 14 | ! 15 | ! !REVISION HISTORY: 16 | ! CVS:$Id: domain_size.F90.test,v 1.2 2003/03/25 13:41:48 pwjones Exp $ 17 | ! CVS:$Name: POP_2_0_1 $ 18 | 19 | ! !USES: 20 | 21 | use kinds_mod 22 | use POP_DomainSizeMod 23 | 24 | implicit none 25 | private 26 | save 27 | 28 | ! !DEFINED PARAMETERS: 29 | 30 | integer (int_kind), parameter, public :: & ! model size parameters 31 | nx_global = POP_nxGlobal, & 32 | ny_global = POP_nyGlobal, & 33 | km = POP_km, & 34 | nt = POP_nt 35 | 36 | integer (int_kind), parameter, public :: & 37 | block_size_x = POP_blockSizeX, & 38 | block_size_y = POP_blockSizeY 39 | 40 | integer (int_kind), parameter, public :: & 41 | max_blocks_clinic = POP_maxBlocksClinic, & 42 | max_blocks_tropic = POP_maxBlocksTropic 43 | 44 | !EOP 45 | !BOC 46 | !EOC 47 | !*********************************************************************** 48 | 49 | end module domain_size 50 | 51 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 52 | -------------------------------------------------------------------------------- /src/omuse/community/pop/dist-60x60-56-16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/pop/dist-60x60-56-16 -------------------------------------------------------------------------------- /src/omuse/community/pop/read_grid.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import numpy 4 | 5 | from amuse.units import units 6 | 7 | from amuse.datamodel import Grid 8 | 9 | class pop_grid_reader(object): 10 | 11 | def __init__(self,filename,nx,ny): 12 | self.filename=filename 13 | 14 | import os.path 15 | import sys 16 | if not os.path.isfile(filename): 17 | sys.exit("Error: No such file " + filename) 18 | 19 | raw=numpy.fromfile(filename).newbyteorder('S') 20 | 21 | grid=raw.reshape((7,ny,nx)) 22 | 23 | # lats=grid[0,:,:]/numpy.pi*180 24 | # lons=grid[1,:,:]/numpy.pi*180 25 | self.lat = lats = grid[0,:,:] 26 | self.lon = lons = grid[1,:,:] 27 | 28 | self.htn = htn = grid[2,:,:] 29 | self.hte = hte = grid[3,:,:] 30 | self.hus = hus = grid[4,:,:] 31 | self.huw = huw = grid[5,:,:] 32 | self.angle = angle = grid[6,:,:] 33 | 34 | #nodes is the U-grid 35 | self.nodes = nodes=Grid(ny*nx) 36 | nodes.lats = lats | units.rad 37 | nodes.lons = lons | units.rad 38 | 39 | def get_sets(self): 40 | return self.nodes 41 | 42 | 43 | 44 | if __name__=="__main__": 45 | 46 | import sys 47 | total = len(sys.argv) 48 | if len(sys.argv) != 4: 49 | sys.exit("Usage: read_grid.py filename nx ny") 50 | filename = sys.argv[1] 51 | nx = int(sys.argv[2]) 52 | ny = int(sys.argv[3]) 53 | 54 | r=pop_grid_reader(filename, nx, ny) 55 | nodes=r.get_sets() 56 | 57 | print nodes 58 | 59 | print nodes.lats 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/omuse/community/pop/run_pop_das5.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from amuse.community.distributed.interface import DistributedAmuseInterface, DistributedAmuse 4 | from amuse.community.distributed.interface import Resource, Resources, Pilot, Pilots 5 | from amuse.units import units 6 | 7 | import numpy 8 | from matplotlib import pyplot 9 | 10 | instance = DistributedAmuse(redirection="none") 11 | instance.parameters.debug = False 12 | instance.parameters.worker_queue_timeout=1 | units.hour 13 | instance.commit_parameters() 14 | 15 | print instance.parameters.webinterface_port 16 | 17 | resource = Resource() 18 | resource.name = "DAS-5" 19 | resource.location = "bwn200@fs0.das5.cs.vu.nl" 20 | resource.scheduler_type = "slurm" 21 | resource.amuse_dir = "/home/bwn200/amuse/amuse" 22 | resource.tmp_dir = "/home/bwn200/tmp" 23 | 24 | instance.resources.add_resource(resource) 25 | 26 | pilot = Pilot() 27 | pilot.resource_name="DAS-5" 28 | pilot.queue_name="defq" 29 | pilot.node_count=56 30 | pilot.time= 1|units.hour 31 | pilot.slots_per_node=16 32 | pilot.label="DAS-5-Pilot" 33 | 34 | instance.pilots.add_pilot(pilot) 35 | instance.use_for_all_workers() 36 | 37 | 38 | from omuse.community.pop.interface import POP 39 | p=POP(channel_type="distributed", redirection="none", mode='3600x2400x42', number_of_workers=896, max_message_length=1000000) 40 | 41 | #set grid info 42 | p.set_horiz_grid_file('/var/scratch/bwn200/pop/input/grid/grid.3600x2400.fob.da') 43 | p.set_vert_grid_file('/var/scratch/bwn200/pop/input/grid/in_depths.42.dat') 44 | p.set_topography_file('/var/scratch/bwn200/pop/input/grid/kmt_pbc.p1_tripole.s2.0-og.20060315.no_caspian_or_black') 45 | p.set_bottom_cell_file('/var/scratch/bwn200/pop/input/grid/dzbc_pbc.p1_tripole.s2.0-og.20060315.no_caspian_or_black') 46 | p.set_ts_file('/var/scratch/bwn200/pop/input/r.t0.1_42l_greenland.01150501') 47 | 48 | #setup forcing files 49 | p.set_shf_monthly_file('/var/scratch/bwn200/pop/input/forcing/shf.NY+H+f.mon') 50 | p.set_sfwf_monthly_file('/var/scratch/bwn200/pop/input/forcing/sfwf.C+r+g8+f.mon') 51 | p.set_ws_monthly_file('/var/scratch/bwn200/pop/input/forcing/ws.o_n_avg.mon') 52 | 53 | #setup output files 54 | #p.set_tavg_option('nday') 55 | #p.set_tavg_freq_option(1) 56 | #p.set_tavg_file('/var/scratch/bwn200/pop/output/tavg/t') 57 | 58 | 59 | 60 | sst = p.elements.temp.value_in(units.C) 61 | 62 | pyplot.imshow(numpy.swapaxes(sst,0,1), origin="lower", cmap=pyplot.cm.jet) 63 | pyplot.show() 64 | 65 | raw_input() 66 | 67 | 68 | 69 | 70 | #go interactive 71 | import readline 72 | import rlcompleter 73 | readline.parse_and_bind("tab: complete") 74 | import code 75 | code.interact(local=dict(globals(), **locals()) ) 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /src/omuse/community/pop/sample_history_contents: -------------------------------------------------------------------------------- 1 | 7 2 | SHGT 3 | UBTROP 4 | VBTROP 5 | UVEL 6 | VVEL 7 | TEMP 8 | SALT 9 | -------------------------------------------------------------------------------- /src/omuse/community/pop/sample_movie_contents: -------------------------------------------------------------------------------- 1 | 8 2 | SHGT 3 | UTRANS 4 | VTRANS 5 | TEMP1_2 6 | SALT1_2 7 | TEMP6 8 | SALT6 9 | VORT 10 | -------------------------------------------------------------------------------- /src/omuse/community/pop/sample_tavg_contents: -------------------------------------------------------------------------------- 1 | 54 2 | SHF 3 | SFWF 4 | SSH 5 | H2 6 | H3 7 | TAUX 8 | TAUY 9 | ADVT 10 | HDIFT 11 | UVEL 12 | VVEL 13 | KE 14 | TEMP 15 | SALT 16 | TEMP2 17 | SALT2 18 | UET 19 | VNT 20 | WTT 21 | UES 22 | VNS 23 | WTS 24 | UEU 25 | VNU 26 | UEV 27 | VNV 28 | PV 29 | Q 30 | PD 31 | UDP 32 | WTU 33 | WTV 34 | ST 35 | RHO 36 | RHOU 37 | RHOV 38 | URHO 39 | VRHO 40 | WRHO 41 | PVWM 42 | PVWP 43 | UPV 44 | VPV 45 | UQ 46 | VQ 47 | U1_8 48 | V1_8 49 | T1_8 50 | S1_8 51 | UV 52 | SU 53 | SV 54 | VUF 55 | VVF 56 | -------------------------------------------------------------------------------- /src/omuse/community/pop/src_120x162x12/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/pop/src_120x162x12/.gitignore -------------------------------------------------------------------------------- /src/omuse/community/pop/src_120x56x12/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/pop/src_120x56x12/.gitignore -------------------------------------------------------------------------------- /src/omuse/community/pop/src_120x56x12/POP_DomainSizeMod.F90: -------------------------------------------------------------------------------- 1 | 2 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 3 | 4 | module POP_DomainSizeMod 5 | 6 | !BOP 7 | ! !MODULE: POP_DomainSizeMod 8 | ! 9 | ! !DESCRIPTION: 10 | ! This module contains parameters for the global model domain size 11 | ! decomposition block size. It is used by the domain and block 12 | ! modules for decomposing the model domain across processors. 13 | ! 14 | ! !REVISION HISTORY: 15 | ! SVN:$Id: POP_DomainSizeMod.F90.test 12 2006-08-15 19:57:39Z $ 16 | ! 2006-08-14: Phil Jones 17 | ! New domain size module following new naming conventions 18 | 19 | ! !USES: 20 | 21 | use POP_KindsMod 22 | 23 | implicit none 24 | private 25 | save 26 | 27 | ! !DEFINED PARAMETERS: 28 | 29 | integer (POP_i4), parameter, public :: & ! model size parameters 30 | POP_nxGlobal = 120 ,& ! extent of horizontal axis in i direction 31 | POP_nyGlobal = 56 ,& ! extent of horizontal axis in j direction 32 | POP_km = 12 ,& ! number of vertical levels 33 | POP_nt = 2 ! total number of tracers 34 | 35 | integer (POP_i4), parameter, public :: & 36 | POP_blockSizeX = 40, &! size of block in first horizontal dimension 37 | POP_blockSizeY = 28 ! size of block in second horizontal dimension 38 | 39 | !*** The model will inform the user of the correct 40 | !*** values for the parameters below. A value higher than 41 | !*** necessary will not cause the code to fail, but will 42 | !*** allocate more memory than is necessary. A value that 43 | !*** is too low will cause the code to exit. 44 | !*** A good initial guess is found using 45 | !*** max=(nx_global/block_size_x)*(ny_global/block_size_y)/ 46 | !*** num_procs 47 | 48 | integer (POP_i4), parameter, public :: & 49 | POP_maxBlocksClinic = 8, &! max number of blocks per processor 50 | POP_maxBlocksTropic = 8 ! in each distribution 51 | 52 | !EOP 53 | !BOC 54 | !EOC 55 | !*********************************************************************** 56 | 57 | end module POP_DomainSizeMod 58 | 59 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 60 | -------------------------------------------------------------------------------- /src/omuse/community/pop/src_120x56x12/domain_size.F90: -------------------------------------------------------------------------------- 1 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 2 | 3 | module domain_size 4 | 5 | !BOP 6 | ! !MODULE: domain_size 7 | ! 8 | ! !DESCRIPTION: 9 | ! This module contains parameters for the global model domain size 10 | ! decomposition block size. It is used by the domain and block 11 | ! modules for decomposing the model domain across processors. 12 | ! Variables are now set in POP\_DomainSizeMod and this routine 13 | ! only provide back compatibility. 14 | ! 15 | ! !REVISION HISTORY: 16 | ! CVS:$Id: domain_size.F90.test,v 1.2 2003/03/25 13:41:48 pwjones Exp $ 17 | ! CVS:$Name: POP_2_0_1 $ 18 | 19 | ! !USES: 20 | 21 | use kinds_mod 22 | use POP_DomainSizeMod 23 | 24 | implicit none 25 | private 26 | save 27 | 28 | ! !DEFINED PARAMETERS: 29 | 30 | integer (int_kind), parameter, public :: & ! model size parameters 31 | nx_global = POP_nxGlobal, & 32 | ny_global = POP_nyGlobal, & 33 | km = POP_km, & 34 | nt = POP_nt 35 | 36 | integer (int_kind), parameter, public :: & 37 | block_size_x = POP_blockSizeX, & 38 | block_size_y = POP_blockSizeY 39 | 40 | integer (int_kind), parameter, public :: & 41 | max_blocks_clinic = POP_maxBlocksClinic, & 42 | max_blocks_tropic = POP_maxBlocksTropic 43 | 44 | !EOP 45 | !BOC 46 | !EOC 47 | !*********************************************************************** 48 | 49 | end module domain_size 50 | 51 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 52 | -------------------------------------------------------------------------------- /src/omuse/community/pop/src_192x160x12/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/pop/src_192x160x12/.gitignore -------------------------------------------------------------------------------- /src/omuse/community/pop/src_240x110x12/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/pop/src_240x110x12/.gitignore -------------------------------------------------------------------------------- /src/omuse/community/pop/src_240x110x12/POP_DomainSizeMod.F90: -------------------------------------------------------------------------------- 1 | 2 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 3 | 4 | module POP_DomainSizeMod 5 | 6 | !BOP 7 | ! !MODULE: POP_DomainSizeMod 8 | ! 9 | ! !DESCRIPTION: 10 | ! This module contains parameters for the global model domain size 11 | ! decomposition block size. It is used by the domain and block 12 | ! modules for decomposing the model domain across processors. 13 | ! 14 | ! !REVISION HISTORY: 15 | ! SVN:$Id: POP_DomainSizeMod.F90.test 12 2006-08-15 19:57:39Z $ 16 | ! 2006-08-14: Phil Jones 17 | ! New domain size module following new naming conventions 18 | 19 | ! !USES: 20 | 21 | use POP_KindsMod 22 | 23 | implicit none 24 | private 25 | save 26 | 27 | ! !DEFINED PARAMETERS: 28 | 29 | integer (POP_i4), parameter, public :: & ! model size parameters 30 | POP_nxGlobal = 240 ,& ! extent of horizontal axis in i direction 31 | POP_nyGlobal = 110 ,& ! extent of horizontal axis in j direction 32 | POP_km = 12 ,& ! number of vertical levels 33 | POP_nt = 2 ! total number of tracers 34 | 35 | integer (POP_i4), parameter, public :: & 36 | POP_blockSizeX = 80, &! size of block in first horizontal dimension 37 | POP_blockSizeY = 22 ! size of block in second horizontal dimension 38 | 39 | !*** The model will inform the user of the correct 40 | !*** values for the parameters below. A value higher than 41 | !*** necessary will not cause the code to fail, but will 42 | !*** allocate more memory than is necessary. A value that 43 | !*** is too low will cause the code to exit. 44 | !*** A good initial guess is found using 45 | !*** max=(nx_global/block_size_x)*(ny_global/block_size_y)/ 46 | !*** num_procs 47 | 48 | integer (POP_i4), parameter, public :: & 49 | POP_maxBlocksClinic = 12, &! max number of blocks per processor 50 | POP_maxBlocksTropic = 12 ! in each distribution 51 | 52 | !EOP 53 | !BOC 54 | !EOC 55 | !*********************************************************************** 56 | 57 | end module POP_DomainSizeMod 58 | 59 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 60 | -------------------------------------------------------------------------------- /src/omuse/community/pop/src_240x110x12/domain_size.F90: -------------------------------------------------------------------------------- 1 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 2 | 3 | module domain_size 4 | 5 | !BOP 6 | ! !MODULE: domain_size 7 | ! 8 | ! !DESCRIPTION: 9 | ! This module contains parameters for the global model domain size 10 | ! decomposition block size. It is used by the domain and block 11 | ! modules for decomposing the model domain across processors. 12 | ! Variables are now set in POP\_DomainSizeMod and this routine 13 | ! only provide back compatibility. 14 | ! 15 | ! !REVISION HISTORY: 16 | ! CVS:$Id: domain_size.F90.test,v 1.2 2003/03/25 13:41:48 pwjones Exp $ 17 | ! CVS:$Name: POP_2_0_1 $ 18 | 19 | ! !USES: 20 | 21 | use kinds_mod 22 | use POP_DomainSizeMod 23 | 24 | implicit none 25 | private 26 | save 27 | 28 | ! !DEFINED PARAMETERS: 29 | 30 | integer (int_kind), parameter, public :: & ! model size parameters 31 | nx_global = POP_nxGlobal, & 32 | ny_global = POP_nyGlobal, & 33 | km = POP_km, & 34 | nt = POP_nt 35 | 36 | integer (int_kind), parameter, public :: & 37 | block_size_x = POP_blockSizeX, & 38 | block_size_y = POP_blockSizeY 39 | 40 | integer (int_kind), parameter, public :: & 41 | max_blocks_clinic = POP_maxBlocksClinic, & 42 | max_blocks_tropic = POP_maxBlocksTropic 43 | 44 | !EOP 45 | !BOC 46 | !EOC 47 | !*********************************************************************** 48 | 49 | end module domain_size 50 | 51 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 52 | -------------------------------------------------------------------------------- /src/omuse/community/pop/src_240x162x12/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/pop/src_240x162x12/.gitignore -------------------------------------------------------------------------------- /src/omuse/community/pop/src_240x216x24/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/pop/src_240x216x24/.gitignore -------------------------------------------------------------------------------- /src/omuse/community/pop/src_320x384x40/POP_DomainSizeMod.F90: -------------------------------------------------------------------------------- 1 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 2 | 3 | module POP_DomainSizeMod 4 | 5 | !BOP 6 | ! !MODULE: POP_DomainSizeMod 7 | ! 8 | ! !DESCRIPTION: 9 | ! This module contains parameters for the global model domain size 10 | ! decomposition block size. It is used by the domain and block 11 | ! modules for decomposing the model domain across processors. 12 | ! 13 | ! !REVISION HISTORY: 14 | ! SVN:$Id: POP_DomainSizeMod.F90.test 12 2006-08-15 19:57:39Z $ 15 | ! 2006-08-14: Phil Jones 16 | ! New domain size module following new naming conventions 17 | 18 | ! !USES: 19 | 20 | use POP_KindsMod 21 | 22 | implicit none 23 | private 24 | save 25 | 26 | ! !DEFINED PARAMETERS: 27 | 28 | integer (POP_i4), parameter, public :: & ! model size parameters 29 | POP_nxGlobal = 320 ,&!320 extent of horizontal axis in i direction 30 | POP_nyGlobal = 384 ,&!384 extent of horizontal axis in j direction 31 | POP_km = 40 ,&!40 number of vertical levels 32 | ! POP_nxGlobal = 3600 ,&!320 extent of horizontal axis in i direction 33 | ! POP_nyGlobal = 2400 ,&!384 extent of horizontal axis in j direction 34 | ! POP_km = 42 ,&!40 number of vertical levels 35 | POP_nt = 2 ! total number of tracers 36 | 37 | integer (POP_i4), parameter, public :: & 38 | ! POP_blockSizeX = 80, &! size of block in first horizontal dimension 39 | ! POP_blockSizeY = 64 ! size of block in second horizontal dimension 40 | POP_blockSizeX = 40, &! size of block in first horizontal dimension 41 | POP_blockSizeY = 48 ! size of block in second horizontal dimension 42 | 43 | !*** The model will inform the user of the correct 44 | !*** values for the parameters below. A value higher than 45 | !*** necessary will not cause the code to fail, but will 46 | !*** allocate more memory than is necessary. A value that 47 | !*** is too low will cause the code to exit. 48 | !*** A good initial guess is found using 49 | !*** max=(nx_global/block_size_x)*(ny_global/block_size_y)/ 50 | !*** num_procs 51 | 52 | integer (POP_i4), parameter, public :: & 53 | POP_maxBlocksClinic = 8, &! max number of blocks per processor 54 | POP_maxBlocksTropic = 8 ! in each distribution 55 | 56 | !EOP 57 | !BOC 58 | !EOC 59 | !*********************************************************************** 60 | 61 | end module POP_DomainSizeMod 62 | 63 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 64 | -------------------------------------------------------------------------------- /src/omuse/community/pop/src_320x384x40/domain_size.F90: -------------------------------------------------------------------------------- 1 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 2 | 3 | module domain_size 4 | 5 | !BOP 6 | ! !MODULE: domain_size 7 | ! 8 | ! !DESCRIPTION: 9 | ! This module contains parameters for the global model domain size 10 | ! decomposition block size. It is used by the domain and block 11 | ! modules for decomposing the model domain across processors. 12 | ! Variables are now set in POP\_DomainSizeMod and this routine 13 | ! only provide back compatibility. 14 | ! 15 | ! !REVISION HISTORY: 16 | ! CVS:$Id: domain_size.F90.test,v 1.2 2003/03/25 13:41:48 pwjones Exp $ 17 | ! CVS:$Name: POP_2_0_1 $ 18 | 19 | ! !USES: 20 | 21 | use kinds_mod 22 | use POP_DomainSizeMod 23 | 24 | implicit none 25 | private 26 | save 27 | 28 | ! !DEFINED PARAMETERS: 29 | 30 | integer (int_kind), parameter, public :: & ! model size parameters 31 | nx_global = POP_nxGlobal, & 32 | ny_global = POP_nyGlobal, & 33 | km = POP_km, & 34 | nt = POP_nt 35 | 36 | integer (int_kind), parameter, public :: & 37 | block_size_x = POP_blockSizeX, & 38 | block_size_y = POP_blockSizeY 39 | 40 | integer (int_kind), parameter, public :: & 41 | max_blocks_clinic = POP_maxBlocksClinic, & 42 | max_blocks_tropic = POP_maxBlocksTropic 43 | 44 | !EOP 45 | !BOC 46 | !EOC 47 | !*********************************************************************** 48 | 49 | end module domain_size 50 | 51 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 52 | -------------------------------------------------------------------------------- /src/omuse/community/pop/src_3600x2400x42/POP_DomainSizeMod.F90: -------------------------------------------------------------------------------- 1 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 2 | 3 | module POP_DomainSizeMod 4 | 5 | !BOP 6 | ! !MODULE: POP_DomainSizeMod 7 | ! 8 | ! !DESCRIPTION: 9 | ! This module contains parameters for the global model domain size 10 | ! decomposition block size. It is used by the domain and block 11 | ! modules for decomposing the model domain across processors. 12 | ! 13 | ! !REVISION HISTORY: 14 | ! SVN:$Id: POP_DomainSizeMod.F90.test 12 2006-08-15 19:57:39Z $ 15 | ! 2006-08-14: Phil Jones 16 | ! New domain size module following new naming conventions 17 | 18 | ! !USES: 19 | 20 | use POP_KindsMod 21 | 22 | implicit none 23 | private 24 | save 25 | 26 | ! !DEFINED PARAMETERS: 27 | 28 | integer (POP_i4), parameter, public :: & ! model size parameters 29 | ! POP_nxGlobal = 320 ,&!320 extent of horizontal axis in i direction 30 | ! POP_nyGlobal = 384 ,&!384 extent of horizontal axis in j direction 31 | ! POP_km = 40 ,&!40 number of vertical levels 32 | POP_nxGlobal = 3600 ,&!320 extent of horizontal axis in i direction 33 | POP_nyGlobal = 2400 ,&!384 extent of horizontal axis in j direction 34 | POP_km = 42 ,&!40 number of vertical levels 35 | POP_nt = 2 ! total number of tracers 36 | 37 | integer (POP_i4), parameter, public :: & 38 | ! POP_blockSizeX = 80, &! size of block in first horizontal dimension 39 | ! POP_blockSizeY = 64 ! size of block in second horizontal dimension 40 | POP_blockSizeX = 60, &! size of block in first horizontal dimension 41 | POP_blockSizeY = 60 ! size of block in second horizontal dimension 42 | 43 | !*** The model will inform the user of the correct 44 | !*** values for the parameters below. A value higher than 45 | !*** necessary will not cause the code to fail, but will 46 | !*** allocate more memory than is necessary. A value that 47 | !*** is too low will cause the code to exit. 48 | !*** A good initial guess is found using 49 | !*** max=(nx_global/block_size_x)*(ny_global/block_size_y)/ 50 | !*** num_procs 51 | 52 | integer (POP_i4), parameter, public :: & 53 | POP_maxBlocksClinic = 6, &! max number of blocks per processor 54 | POP_maxBlocksTropic = 6 ! in each distribution 55 | 56 | !EOP 57 | !BOC 58 | !EOC 59 | !*********************************************************************** 60 | 61 | end module POP_DomainSizeMod 62 | 63 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 64 | -------------------------------------------------------------------------------- /src/omuse/community/pop/src_3600x2400x42/domain_size.F90: -------------------------------------------------------------------------------- 1 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 2 | 3 | module domain_size 4 | 5 | !BOP 6 | ! !MODULE: domain_size 7 | ! 8 | ! !DESCRIPTION: 9 | ! This module contains parameters for the global model domain size 10 | ! decomposition block size. It is used by the domain and block 11 | ! modules for decomposing the model domain across processors. 12 | ! Variables are now set in POP\_DomainSizeMod and this routine 13 | ! only provide back compatibility. 14 | ! 15 | ! !REVISION HISTORY: 16 | ! CVS:$Id: domain_size.F90.test,v 1.2 2003/03/25 13:41:48 pwjones Exp $ 17 | ! CVS:$Name: POP_2_0_1 $ 18 | 19 | ! !USES: 20 | 21 | use kinds_mod 22 | use POP_DomainSizeMod 23 | 24 | implicit none 25 | private 26 | save 27 | 28 | ! !DEFINED PARAMETERS: 29 | 30 | integer (int_kind), parameter, public :: & ! model size parameters 31 | nx_global = POP_nxGlobal, & 32 | ny_global = POP_nyGlobal, & 33 | km = POP_km, & 34 | nt = POP_nt 35 | 36 | integer (int_kind), parameter, public :: & 37 | block_size_x = POP_blockSizeX, & 38 | block_size_y = POP_blockSizeY 39 | 40 | integer (int_kind), parameter, public :: & 41 | max_blocks_clinic = POP_maxBlocksClinic, & 42 | max_blocks_tropic = POP_maxBlocksTropic 43 | 44 | !EOP 45 | !BOC 46 | !EOC 47 | !*********************************************************************** 48 | 49 | end module domain_size 50 | 51 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 52 | -------------------------------------------------------------------------------- /src/omuse/community/pop/src_96x120x12/POP_DomainSizeMod.F90: -------------------------------------------------------------------------------- 1 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 2 | 3 | module POP_DomainSizeMod 4 | 5 | !BOP 6 | ! !MODULE: POP_DomainSizeMod 7 | ! 8 | ! !DESCRIPTION: 9 | ! This module contains parameters for the global model domain size 10 | ! decomposition block size. It is used by the domain and block 11 | ! modules for decomposing the model domain across processors. 12 | ! 13 | ! !REVISION HISTORY: 14 | ! SVN:$Id: POP_DomainSizeMod.F90.test 12 2006-08-15 19:57:39Z $ 15 | ! 2006-08-14: Phil Jones 16 | ! New domain size module following new naming conventions 17 | 18 | ! !USES: 19 | 20 | use POP_KindsMod 21 | 22 | implicit none 23 | private 24 | save 25 | 26 | ! !DEFINED PARAMETERS: 27 | 28 | integer (POP_i4), parameter, public :: & ! model size parameters 29 | POP_nxGlobal = 96 ,&!320 extent of horizontal axis in i direction 30 | POP_nyGlobal = 120 ,&!384 extent of horizontal axis in j direction 31 | POP_km = 12 ,&!40 number of vertical levels 32 | POP_nt = 2 ! total number of tracers 33 | 34 | integer (POP_i4), parameter, public :: & 35 | POP_blockSizeX = 32, &! size of block in first horizontal dimension 36 | POP_blockSizeY = 40 ! size of block in second horizontal dimension 37 | 38 | !*** The model will inform the user of the correct 39 | !*** values for the parameters below. A value higher than 40 | !*** necessary will not cause the code to fail, but will 41 | !*** allocate more memory than is necessary. A value that 42 | !*** is too low will cause the code to exit. 43 | !*** A good initial guess is found using 44 | !*** max=(nx_global/block_size_x)*(ny_global/block_size_y)/ 45 | !*** num_procs 46 | 47 | integer (POP_i4), parameter, public :: & 48 | POP_maxBlocksClinic = 4, &! max number of blocks per processor 49 | POP_maxBlocksTropic = 4 ! in each distribution 50 | 51 | !EOP 52 | !BOC 53 | !EOC 54 | !*********************************************************************** 55 | 56 | end module POP_DomainSizeMod 57 | 58 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 59 | -------------------------------------------------------------------------------- /src/omuse/community/pop/src_96x120x12/domain_size.F90: -------------------------------------------------------------------------------- 1 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 2 | 3 | module domain_size 4 | 5 | !BOP 6 | ! !MODULE: domain_size 7 | ! 8 | ! !DESCRIPTION: 9 | ! This module contains parameters for the global model domain size 10 | ! decomposition block size. It is used by the domain and block 11 | ! modules for decomposing the model domain across processors. 12 | ! Variables are now set in POP\_DomainSizeMod and this routine 13 | ! only provide back compatibility. 14 | ! 15 | ! !REVISION HISTORY: 16 | ! CVS:$Id: domain_size.F90.test,v 1.2 2003/03/25 13:41:48 pwjones Exp $ 17 | ! CVS:$Name: POP_2_0_1 $ 18 | 19 | ! !USES: 20 | 21 | use kinds_mod 22 | use POP_DomainSizeMod 23 | 24 | implicit none 25 | private 26 | save 27 | 28 | ! !DEFINED PARAMETERS: 29 | 30 | integer (int_kind), parameter, public :: & ! model size parameters 31 | nx_global = POP_nxGlobal, & 32 | ny_global = POP_nyGlobal, & 33 | km = POP_km, & 34 | nt = POP_nt 35 | 36 | integer (int_kind), parameter, public :: & 37 | block_size_x = POP_blockSizeX, & 38 | block_size_y = POP_blockSizeY 39 | 40 | integer (int_kind), parameter, public :: & 41 | max_blocks_clinic = POP_maxBlocksClinic, & 42 | max_blocks_tropic = POP_maxBlocksTropic 43 | 44 | !EOP 45 | !BOC 46 | !EOC 47 | !*********************************************************************** 48 | 49 | end module domain_size 50 | 51 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 52 | -------------------------------------------------------------------------------- /src/omuse/community/pop/src_96x40x12/POP_DomainSizeMod.F90: -------------------------------------------------------------------------------- 1 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 2 | 3 | module POP_DomainSizeMod 4 | 5 | !BOP 6 | ! !MODULE: POP_DomainSizeMod 7 | ! 8 | ! !DESCRIPTION: 9 | ! This module contains parameters for the global model domain size 10 | ! decomposition block size. It is used by the domain and block 11 | ! modules for decomposing the model domain across processors. 12 | ! 13 | ! !REVISION HISTORY: 14 | ! SVN:$Id: POP_DomainSizeMod.F90.test 12 2006-08-15 19:57:39Z $ 15 | ! 2006-08-14: Phil Jones 16 | ! New domain size module following new naming conventions 17 | 18 | ! !USES: 19 | 20 | use POP_KindsMod 21 | 22 | implicit none 23 | private 24 | save 25 | 26 | ! !DEFINED PARAMETERS: 27 | 28 | integer (POP_i4), parameter, public :: & ! model size parameters 29 | POP_nxGlobal = 96 ,&!320 extent of horizontal axis in i direction 30 | POP_nyGlobal = 40 ,&!384 extent of horizontal axis in j direction 31 | POP_km = 12 ,&!40 number of vertical levels 32 | POP_nt = 2 ! total number of tracers 33 | 34 | integer (POP_i4), parameter, public :: & 35 | POP_blockSizeX = 32, &! size of block in first horizontal dimension 36 | POP_blockSizeY = 20 ! size of block in second horizontal dimension 37 | 38 | !*** The model will inform the user of the correct 39 | !*** values for the parameters below. A value higher than 40 | !*** necessary will not cause the code to fail, but will 41 | !*** allocate more memory than is necessary. A value that 42 | !*** is too low will cause the code to exit. 43 | !*** A good initial guess is found using 44 | !*** max=(nx_global/block_size_x)*(ny_global/block_size_y)/ 45 | !*** num_procs 46 | 47 | integer (POP_i4), parameter, public :: & 48 | POP_maxBlocksClinic = 2, &! max number of blocks per processor 49 | POP_maxBlocksTropic = 2 ! in each distribution 50 | 51 | !EOP 52 | !BOC 53 | !EOC 54 | !*********************************************************************** 55 | 56 | end module POP_DomainSizeMod 57 | 58 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 59 | -------------------------------------------------------------------------------- /src/omuse/community/pop/src_96x40x12/domain_size.F90: -------------------------------------------------------------------------------- 1 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 2 | 3 | module domain_size 4 | 5 | !BOP 6 | ! !MODULE: domain_size 7 | ! 8 | ! !DESCRIPTION: 9 | ! This module contains parameters for the global model domain size 10 | ! decomposition block size. It is used by the domain and block 11 | ! modules for decomposing the model domain across processors. 12 | ! Variables are now set in POP\_DomainSizeMod and this routine 13 | ! only provide back compatibility. 14 | ! 15 | ! !REVISION HISTORY: 16 | ! CVS:$Id: domain_size.F90.test,v 1.2 2003/03/25 13:41:48 pwjones Exp $ 17 | ! CVS:$Name: POP_2_0_1 $ 18 | 19 | ! !USES: 20 | 21 | use kinds_mod 22 | use POP_DomainSizeMod 23 | 24 | implicit none 25 | private 26 | save 27 | 28 | ! !DEFINED PARAMETERS: 29 | 30 | integer (int_kind), parameter, public :: & ! model size parameters 31 | nx_global = POP_nxGlobal, & 32 | ny_global = POP_nyGlobal, & 33 | km = POP_km, & 34 | nt = POP_nt 35 | 36 | integer (int_kind), parameter, public :: & 37 | block_size_x = POP_blockSizeX, & 38 | block_size_y = POP_blockSizeY 39 | 40 | integer (int_kind), parameter, public :: & 41 | max_blocks_clinic = POP_maxBlocksClinic, & 42 | max_blocks_tropic = POP_maxBlocksTropic 43 | 44 | !EOP 45 | !BOC 46 | !EOC 47 | !*********************************************************************** 48 | 49 | end module domain_size 50 | 51 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 52 | -------------------------------------------------------------------------------- /src/omuse/community/pop/start_pop.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from omuse.community.pop.interface import POP 4 | from amuse.units import units 5 | import numpy 6 | 7 | p=POP(channel_type="sockets",redirection="none",number_of_workers=8) 8 | 9 | #set the grid we want to use 10 | p.set_horiz_grid_file('data/input/grid/horiz_grid_20010402.ieeer8') 11 | p.set_vert_grid_file('data/input/grid/in_depths.dat') 12 | p.set_topography_file('data/input/grid/topography_20010702.ieeei4') 13 | 14 | #set the restart file 15 | p.set_ts_file('data/input/restart/r.x1_SAMOC_control.00750101') 16 | 17 | #setup the forcing 18 | p.set_shf_monthly_file('data/input/shf_monthly/shf.normal_year+flux.mon') 19 | p.set_sfwf_monthly_file('data/input/sfwf/sfwf_phc0-50_ncarp_r46_flux.mon') 20 | p.set_ws_monthly_file('data/input/ws_monthly/ws.1958-2000.mon') 21 | 22 | 23 | 24 | #retrieve sst values 25 | sst = p.elements.temp.value_in(units.C) 26 | 27 | #create a plot using sst values 28 | #from pop_plot import * 29 | #pop_plot(p, sst) 30 | 31 | #from matplotlib import pyplot 32 | #pyplot.imshow(sst) 33 | #pyplot.show() 34 | 35 | 36 | #go interactive 37 | import readline 38 | import rlcompleter 39 | readline.parse_and_bind("tab: complete") 40 | import code 41 | code.interact(local=dict(globals(), **locals()) ) 42 | 43 | -------------------------------------------------------------------------------- /src/omuse/community/pop/tavg_contents: -------------------------------------------------------------------------------- 1 | 15 2 | SHF 3 | SFWF 4 | SSH 5 | H2 6 | TAUX 7 | TAUY 8 | UVEL 9 | VVEL 10 | KE 11 | TEMP 12 | SALT 13 | PD 14 | RHO 15 | HMXL 16 | XMXL 17 | TMXL 18 | -------------------------------------------------------------------------------- /src/omuse/community/pop/transport_contents: -------------------------------------------------------------------------------- 1 | 17 2 | 297 297 24 47 1 40 merid Drake Passage 3 | 65 76 103 103 1 40 zonal Mozambique Channel 4 | 198 202 333 333 1 40 zonal Bering Strait 5 | 254 261 372 372 1 40 zonal Northwest Passage 6 | 293 306 366 366 1 40 zonal Davis Strait 7 | 289 289 351 355 1 40 merid Hudson Strait 8 | 30 30 365 377 1 40 merid Denmark Strait 9 | 30 30 335 361 1 40 merid Iceland-Ireland 10 | 102 102 369 382 1 40 merid Fram Strait 11 | 102 102 352 368 1 40 merid Barents Sea 12 | 131 131 164 167 1 40 merid Indonesian Throughflow I 13 | 138 159 156 156 1 40 zonal Indonesian Throughflow II 14 | 163 163 147 151 1 40 merid Indonesian Throughflow III 15 | 284 284 264 270 1 40 merid Florida Strait 16 | 289 292 258 258 1 40 zonal Windward Passage I 17 | 292 292 257 258 1 40 merid Windward Passage II 18 | 32 32 290 295 1 40 merid Gibraltar 19 | -------------------------------------------------------------------------------- /src/omuse/community/qgcm/__init__.py: -------------------------------------------------------------------------------- 1 | # relative import hack 2 | # https://stackoverflow.com/questions/16981921/relative-imports-in-python-3 3 | import os, sys; sys.path.append(os.path.dirname(os.path.realpath(__file__))) 4 | -------------------------------------------------------------------------------- /src/omuse/community/qgcm/hogg2006.config: -------------------------------------------------------------------------------- 1 | # 2 | # Q-GCM configuration macro v1.5.0 3 | # ================================ 4 | 5 | # This configuration file specifies those model options 6 | # set via the preprocessor, and should be provided 7 | # to the Makefile by linking it to make.config 8 | 9 | # Set model preprocessor options: 10 | # ------------------------------- 11 | #ATOPT = -Datmos_only 12 | OCOPT = -Docean_only 13 | #AROPT = -Dget_areav 14 | #CVOPT = -Dget_covar 15 | #NCOPT = -Duse_netcdf 16 | CYCLIC = -Dcyclic_ocean 17 | #HFLUX = -Dsb_hflux 18 | #HFLUX = -Dnb_hflux 19 | #TAUDIF = -Dtau_udiff 20 | #QOCDIAG = -Dqoc_diag 21 | # ATOPT: option to run in atmosphere-only mode 22 | # OCOPT: option to run in ocean-only mode 23 | # AROPT: option to accumulate area averages as program runs 24 | # CVOPT: option to accumulate covariance statistics as program runs 25 | # NCOPT: option to enable netCDF input/output 26 | # CYCLIC: ocean is cyclic in x (otherwise a finite, centred box) 27 | # HFLUX: ocean m.l. has artificial heat flux applied by modified 28 | # zonal b.c. (only allowed at one of N & S boundaries at most) 29 | # It should only be applied (if at all) on the equatorward 30 | # zonal boundary, this is enforced by checking for consistency 31 | # with the sign of fnot, set in parameters_data.F) 32 | # TAUDIF: stress depends on velocity difference, not just on atmospheric velocity 33 | # i.e. turning this on activates the Duhaut & Straub windstress formulation 34 | # QOCDIAG: optional ocean vorticity diagnostics module is activated 35 | ## WARNINGS - Don't use ocean_only and atmos_only together 36 | ## - Don't use sb_hflux and nb_hflux together 37 | QGOPTS = ${ATOPT} ${OCOPT} ${AROPT} ${CVOPT} ${NCOPT} ${CYCLIC} ${HFLUX} ${TAUDIF} ${QOCDIAG} 38 | QGOPTS += -Denforce_adiabatic_mixed_layer 39 | QGOPTS += -DAMUSE 40 | -------------------------------------------------------------------------------- /src/omuse/community/qgcm/hogg2006_20km.config: -------------------------------------------------------------------------------- 1 | # 2 | # Q-GCM configuration macro v1.5.0 3 | # ================================ 4 | 5 | # This configuration file specifies those model options 6 | # set via the preprocessor, and should be provided 7 | # to the Makefile by linking it to make.config 8 | 9 | # Set model preprocessor options: 10 | # ------------------------------- 11 | #ATOPT = -Datmos_only 12 | OCOPT = -Docean_only 13 | #AROPT = -Dget_areav 14 | #CVOPT = -Dget_covar 15 | #NCOPT = -Duse_netcdf 16 | CYCLIC = -Dcyclic_ocean 17 | #HFLUX = -Dsb_hflux 18 | #HFLUX = -Dnb_hflux 19 | #TAUDIF = -Dtau_udiff 20 | #QOCDIAG = -Dqoc_diag 21 | # ATOPT: option to run in atmosphere-only mode 22 | # OCOPT: option to run in ocean-only mode 23 | # AROPT: option to accumulate area averages as program runs 24 | # CVOPT: option to accumulate covariance statistics as program runs 25 | # NCOPT: option to enable netCDF input/output 26 | # CYCLIC: ocean is cyclic in x (otherwise a finite, centred box) 27 | # HFLUX: ocean m.l. has artificial heat flux applied by modified 28 | # zonal b.c. (only allowed at one of N & S boundaries at most) 29 | # It should only be applied (if at all) on the equatorward 30 | # zonal boundary, this is enforced by checking for consistency 31 | # with the sign of fnot, set in parameters_data.F) 32 | # TAUDIF: stress depends on velocity difference, not just on atmospheric velocity 33 | # i.e. turning this on activates the Duhaut & Straub windstress formulation 34 | # QOCDIAG: optional ocean vorticity diagnostics module is activated 35 | ## WARNINGS - Don't use ocean_only and atmos_only together 36 | ## - Don't use sb_hflux and nb_hflux together 37 | QGOPTS = ${ATOPT} ${OCOPT} ${AROPT} ${CVOPT} ${NCOPT} ${CYCLIC} ${HFLUX} ${TAUDIF} ${QOCDIAG} 38 | QGOPTS += -Denforce_adiabatic_mixed_layer 39 | QGOPTS += -DAMUSE 40 | -------------------------------------------------------------------------------- /src/omuse/community/qgcm/make.macro: -------------------------------------------------------------------------------- 1 | # 2 | # Q-GCM system-specific macro v1.5.0 3 | # ================================== 4 | 5 | # dummy (AMUSE flags passed on) 6 | 7 | TPFLAGS = ${FFLAGS} 8 | DEBUGS = ${FFLAGS} 9 | 10 | MKLDIR ?= /opt/intel/composer_xe_2011_sp1.9.293//mkl/ 11 | MKLPATH ?= ${MKLDIR}/lib/intel64 12 | MKLINCLUDE ?= ${MKLDIR}/include 13 | # LAPACK = -L${MKLPATH} -I${MKLINCLUDE} -Wl,--start-group ${MKLPATH}/libmkl_intel_lp64.a ${MKLPATH}/libmkl_sequential.a ${MKLPATH}/libmkl_core.a -Wl,--end-group -lpthread 14 | # version for single-thread testing: 15 | # For the sequential version, no RTL should be needed, but the 16 | # POSIX thread library (pthread) will be needed for thread-safety 17 | # Alternative workstation access to LAPACK/BLAS using the NAG library 18 | # LAPACK = -L${NAGDIR} -lnag_nag 19 | # Alternative provision of LAPACK/BLAS from the supplied source code 20 | # Set either LAPACK, or both of LAPSRC and LAPOBJ, but not all three 21 | LAPSRC = lasubs.f 22 | LAPOBJ = lasubs.o 23 | 24 | NCBASE = $(NETCDFF_PREFIX) 25 | NCIDIR = ${NCBASE}/include 26 | NCDINC = ${NCIDIR}/netcdf.inc 27 | NCINCL = -I${NCIDIR} 28 | NCLINK = -L${NCBASE}/lib -lnetcdff -lnetcdf 29 | 30 | -------------------------------------------------------------------------------- /src/omuse/community/qgcm/ocean_only.config: -------------------------------------------------------------------------------- 1 | # 2 | # Q-GCM configuration macro v1.5.0 3 | # ================================ 4 | 5 | # This configuration file specifies those model options 6 | # set via the preprocessor, and should be provided 7 | # to the Makefile by linking it to make.config 8 | 9 | # Set model preprocessor options: 10 | # ------------------------------- 11 | #ATOPT = -Datmos_only 12 | OCOPT = -Docean_only 13 | #AROPT = -Dget_areav 14 | #CVOPT = -Dget_covar 15 | NCOPT = -Duse_netcdf 16 | #CYCLIC = -Dcyclic_ocean 17 | HFLUX = -Dsb_hflux 18 | #HFLUX = -Dnb_hflux 19 | #TAUDIF = -Dtau_udiff 20 | QOCDIAG = -Dqoc_diag 21 | # ATOPT: option to run in atmosphere-only mode 22 | # OCOPT: option to run in ocean-only mode 23 | # AROPT: option to accumulate area averages as program runs 24 | # CVOPT: option to accumulate covariance statistics as program runs 25 | # NCOPT: option to enable netCDF input/output 26 | # CYCLIC: ocean is cyclic in x (otherwise a finite, centred box) 27 | # HFLUX: ocean m.l. has artificial heat flux applied by modified 28 | # zonal b.c. (only allowed at one of N & S boundaries at most) 29 | # It should only be applied (if at all) on the equatorward 30 | # zonal boundary, this is enforced by checking for consistency 31 | # with the sign of fnot, set in parameters_data.F) 32 | # TAUDIF: stress depends on velocity difference, not just on atmospheric velocity 33 | # i.e. turning this on activates the Duhaut & Straub windstress formulation 34 | # QOCDIAG: optional ocean vorticity diagnostics module is activated 35 | ## WARNINGS - Don't use ocean_only and atmos_only together 36 | ## - Don't use sb_hflux and nb_hflux together 37 | QGOPTS = ${ATOPT} ${OCOPT} ${AROPT} ${CVOPT} ${NCOPT} ${CYCLIC} ${HFLUX} ${TAUDIF} ${QOCDIAG} 38 | 39 | -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/Makefile: -------------------------------------------------------------------------------- 1 | ifeq ($(origin AMUSE_DIR), undefined) 2 | AMUSE_DIR := $(shell amusifier --get-amuse-dir) 3 | endif 4 | -include ${AMUSE_DIR}/config.mk 5 | 6 | MPIFC ?= mpif90 7 | FORTRAN=$(FC) 8 | 9 | ifneq (,$(findstring gfortran, $(notdir $(FORTRAN)))) 10 | FISHPACK_FLAGS = -fdefault-real-8 11 | export FISHPACK_FLAGS 12 | LDFLAGS += -L./src/fishpack4.1/lib/ -lfishpack 13 | FCFLAGS += -fno-automatic 14 | endif 15 | 16 | ifeq ($(findstring ifort, $(notdir $(FORTRAN))), ifort) 17 | # ifort flags 18 | LDFLAGS += -O2 -lm -mkl -I./src/include 19 | FCFLAGS += -O2 -mkl -I./src/include -heap-arrays 1024 20 | endif 21 | 22 | OBJS = interface.o 23 | 24 | CODELIB = src/libqgmodel.a 25 | 26 | CODE_GENERATOR:=amusifier 27 | 28 | all: qgmodel_worker 29 | 30 | clean: 31 | $(RM) -f *.so *.o *.pyc *.mod worker_code.cc worker_code.h 32 | $(RM) *~ worker_code worker_code.f90 qgmodel_worker 33 | $(RM) -rf qgmodel_worker.dSYM 34 | make -C src clean 35 | 36 | $(CODELIB): 37 | make -C src all 38 | 39 | worker_code.f90: interface.py 40 | $(CODE_GENERATOR) --type=f90 interface.py QGmodelInterface -o $@ 41 | 42 | qgmodel_worker: worker_code.f90 $(CODELIB) $(OBJS) 43 | $(MPIFC) $(FCFLAGS) $(FS_FLAGS) $< $(OBJS) $(CODELIB) $(FS_LIBS) $(LDFLAGS) -o $@ 44 | 45 | %.o: %.f90 46 | $(MPIFC) $(FCFLAGS) -c -o $@ $< 47 | -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/__init__.py: -------------------------------------------------------------------------------- 1 | # generated file -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/dijkstra2005.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | from amuse.units import units 4 | 5 | from matplotlib import pyplot 6 | 7 | from interface import QGmodel,QGmodelInterface 8 | 9 | # run with dijkstra 2005 parameters 10 | def sample_run(Nx=128,Ny=128,Reynolds_number=50.,wind_sigma=1.,dtplot=24.| units.hour,nstep=10): 11 | 12 | qg=QGmodel(redirection="none") 13 | qg.initialize_code() 14 | 15 | L=1.e6 | units.m 16 | 17 | qg.parameters.Lx=L 18 | qg.parameters.Ly=L 19 | qg.parameters.dx=qg.parameters.Lx/Nx 20 | qg.parameters.dy=qg.parameters.Ly/Ny 21 | qg.parameters.ocean_depth=600 | units.m 22 | qg.parameters.tau=0.15 | units.Pa 23 | qg.parameters.beta0=1.6e-11 | (units.m*units.s)**-1 24 | qg.parameters.dt=900 | units.s 25 | 26 | rho0=qg.parameters.rho 27 | beta0=qg.parameters.beta0 28 | H=qg.parameters.ocean_depth 29 | L=qg.parameters.Lx 30 | T=qg.parameters.tau 31 | 32 | U_dijkstra=1.6e-2 | units.m/units.s # mentioned in paper 33 | U=(T/(beta0*rho0*H*L)) # actual derived from parameters 34 | print("actual, target U:", U.in_(units.m/units.s), U_dijkstra) 35 | 36 | A_H=U*L/Reynolds_number 37 | 38 | qg.parameters.A_H=A_H 39 | 40 | qg.parameters.wind_sigma=wind_sigma 41 | 42 | timescale=1/(beta0*L) 43 | 44 | print("timescale:", timescale.in_(units.s)) 45 | print() 46 | print(qg.parameters) 47 | raw_input() 48 | 49 | qg.commit_parameters() 50 | 51 | # qg.grid.psi=(qg.grid.x/L ) | units.m**2/units.s 52 | 53 | qg.initialize_grid() 54 | 55 | pyplot.ion() 56 | f=pyplot.figure() 57 | pyplot.show() 58 | 59 | 60 | for i in range(nstep+1): 61 | tend=i*dtplot 62 | 63 | qg.evolve_model(tend) 64 | psi=qg.grid.psi[:,:,0] 65 | 66 | print(qg.model_time.in_(units.day),(psi.max()/L).in_(units.km/units.hour), \ 67 | (psi.min()/L).in_(units.km/units.hour)) 68 | 69 | f.clf() 70 | 71 | extent=[0,L.value_in(units.km),0,L.value_in(units.km)] 72 | pyplot.imshow(psi.transpose()/max(psi.max(),-psi.min()),vmin=-1,vmax=1,origin="lower",extent=extent) 73 | pyplot.xlabel("km") 74 | pyplot.title(str(qg.model_time.in_(units.day))) 75 | 76 | pyplot.draw() 77 | raw_input() 78 | 79 | 80 | 81 | 82 | if __name__=="__main__": 83 | sample_run(Nx=256,Ny=256,Reynolds_number=60.,wind_sigma=0.) 84 | 85 | -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/plot_wind.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | from amuse.units import units 4 | from interface import single_gyre_wind_model,jans_wind_model,dijkstra_wind_model 5 | 6 | from matplotlib import pyplot 7 | 8 | L=1000. | units.km 9 | 10 | a=numpy.arange(1001)/1000.*L 11 | 12 | tau=1. 13 | 14 | w0=single_gyre_wind_model(0.*a,a,L,tau) 15 | w1=jans_wind_model(0.*a,a,L,tau) 16 | w2=dijkstra_wind_model(0.*a,a,L,tau,sigma=1) 17 | w3=dijkstra_wind_model(0.*a,a,L,tau,sigma=0.5) 18 | 19 | pyplot.plot(w0[0],a/L,'r') 20 | pyplot.plot(w1[0],a/L,'g') 21 | pyplot.plot(w2[0],a/L,'b') 22 | pyplot.plot(w3[0],a/L,'y') 23 | pyplot.show() 24 | 25 | -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/run_qgmodel.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | from os import path 4 | 5 | #try: 6 | #from amuse.community.qgmodel.interface import QGmodel,QGmodelInterface 7 | #except ImportError as ex: 8 | from interface import QGmodel,QGmodelInterface 9 | 10 | from amuse.units import units 11 | 12 | from matplotlib import pyplot 13 | 14 | 15 | def low_level(): 16 | 17 | q=QGmodelInterface(redirection="none") 18 | 19 | print(1) 20 | q.initialize_code() 21 | print(2) 22 | 23 | q.set_Lx(4.e6) 24 | q.set_Ly(4.e6) 25 | q.set_dx(1.e4) 26 | q.set_dy(1.e4) 27 | q.set_dt(1800) 28 | 29 | q.commit_parameters() 30 | print(3) 31 | 32 | q.initialize_grid() 33 | print(4) 34 | 35 | q.evolve_model(86400.) 36 | print(5) 37 | print(q.get_time()) 38 | 39 | x,y=numpy.mgrid[0:400,0:400] 40 | 41 | x=x.flatten()+1 42 | y=y.flatten()+1 43 | 44 | psi,err= q.get_psi1_state(x,y,1) 45 | 46 | psi=psi.reshape((400,400)) 47 | 48 | print(psi.shape) 49 | pyplot.imshow(psi) 50 | 51 | pyplot.show() 52 | 53 | def high_level(): 54 | 55 | qg=QGmodel(redirection="none") 56 | qg.initialize_code() 57 | 58 | Nx=128 59 | Ny=128 60 | 61 | qg.parameters.Lx=1.e6 | units.m 62 | qg.parameters.Ly=1.e6 | units.m 63 | qg.parameters.dx=qg.parameters.Lx/Nx 64 | qg.parameters.dy=qg.parameters.Ly/Ny 65 | qg.parameters.ocean_depth=600 | units.m 66 | qg.parameters.tau=0.15 | units.Pa 67 | qg.parameters.beta0=1.6e-11 | (units.m*units.s)**-1 68 | 69 | qg.parameters.dt=1800/10 | units.s 70 | 71 | rho0=qg.parameters.rho 72 | beta0=qg.parameters.beta0 73 | H=qg.parameters.ocean_depth 74 | L=qg.parameters.Lx 75 | T=qg.parameters.tau 76 | 77 | U_dijkstra=1.6e-2 | units.m/units.s 78 | U=(T/(beta0*rho0*H*L)) 79 | print("actual, target U:", U.in_(units.m/units.s), U_dijkstra) 80 | 81 | 82 | Reynolds_number=1. 83 | 84 | A_H=U*L/Reynolds_number 85 | 86 | qg.parameters.A_H=A_H 87 | 88 | timescale=1/(beta0*L) 89 | 90 | print("timescale:", timescale.in_(units.s)) 91 | print(qg.parameters) 92 | 93 | qg.commit_parameters() 94 | 95 | # qg.grid.psi=(qg.grid.x/L ) | units.m**2/units.s 96 | 97 | qg.initialize_grid() 98 | 99 | pyplot.ion() 100 | f=pyplot.figure() 101 | pyplot.show() 102 | 103 | for i in range(101): 104 | tend=i*12.| units.hour 105 | 106 | qg.evolve_model(tend) 107 | psi=qg.grid.psi[:,:,0] 108 | 109 | print(qg.model_time.in_(units.day),psi.max(),psi.min()) 110 | 111 | pyplot.imshow(psi.transpose()/psi.max(),vmin=0,vmax=1,origin="lower") 112 | 113 | pyplot.draw() 114 | raw_input() 115 | 116 | 117 | 118 | 119 | if __name__=="__main__": 120 | high_level() 121 | 122 | -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/src/Makefile: -------------------------------------------------------------------------------- 1 | MPIFC ?= mpif90 2 | FORTRAN=$(FC) 3 | FCFLAGS+=-std=legacy 4 | ifneq (,$(findstring gfortran, $(notdir $(FORTRAN)))) 5 | FISHPACK_FLAGS += -fdefault-real-8 6 | export FISHPACK_FLAGS 7 | CODEOBJS = beta.o d_Poisson_2D_f_fishpack.o main.o vis_bot.o chi.o \ 8 | jacobian.o vis_lat.o 9 | endif 10 | 11 | ifeq ($(findstring ifort, $(notdir $(FORTRAN))), ifort) 12 | # ifort flags 13 | LDFLAGS += -lm -mkl 14 | FCFLAGS += -mkl -I./include 15 | CODEOBJS = beta.o d_Poisson_2D_f.o main.o vis_bot.o chi.o \ 16 | jacobian.o vis_lat.o 17 | endif 18 | 19 | 20 | CODELIB = libqgmodel.a 21 | 22 | AR = ar ruv 23 | RANLIB = ranlib 24 | RM = rm 25 | 26 | all: mkl $(CODELIB) 27 | 28 | 29 | clean: 30 | $(RM) -f *.o *.a *.mod a.out 31 | make -C include clean 32 | make -C fishpack4.1 clean 33 | 34 | $(CODELIB): $(CODEOBJS) 35 | $(RM) -f $@ 36 | $(AR) $@ $(CODEOBJS) 37 | $(RANLIB) $@ 38 | 39 | %.o: %.f90 40 | $(FC) $(FCFLAGS) -c -o $@ $< 41 | 42 | mkl: 43 | ifeq ($(findstring ifort, $(notdir $(FORTRAN))), ifort) 44 | make -C include all 45 | else 46 | make -C fishpack4.1 all FC="$(FC) $(FISHPACK_FLAGS)" 47 | endif 48 | -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/src/beta.f90: -------------------------------------------------------------------------------- 1 | subroutine beta(Nm,Nx,Ny,psi,beta_term) 2 | 3 | implicit none 4 | integer, intent(in) :: Nx,Ny,Nm 5 | real(8), dimension(Nm,Nx,Ny), intent(in) :: psi 6 | real(8), dimension(Nm,Nx,Ny), intent(out) :: beta_term 7 | 8 | integer :: i,j,m 9 | 10 | beta_term(:,:,:) = 0.d0 11 | 12 | do m=1,Nm 13 | do i=2,Nx-1 14 | do j=2,Ny-1 15 | 16 | beta_term(m,i,j) = psi(m,i+1,j)-psi(m,i-1,j) 17 | 18 | end do 19 | end do 20 | end do 21 | !write(*,*) beta_term 22 | 23 | end 24 | 25 | -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/src/fishpack4.1/Makefile: -------------------------------------------------------------------------------- 1 | all: lib/libfishpack.a testfishpack 2 | 3 | lib/libfishpack.a: 4 | mkdir -p ./lib 5 | mkdir -p ./objs 6 | ( cd ./src; $(MAKE) clean; $(MAKE) ) 7 | 8 | testfishpack: lib/libfishpack.a 9 | ( cd ./test; $(MAKE) clean; $(MAKE) ) 10 | 11 | clean: 12 | ( cd ./src; $(MAKE) clean; cd ../test; $(MAKE) clean ) 13 | -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/src/fishpack4.1/doc/FISH.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/qgmodel/src/fishpack4.1/doc/FISH.gif -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/src/fishpack4.1/doc/README_FISHPACK4.1: -------------------------------------------------------------------------------- 1 | FISHPACK 4.1 2 | ------------ 3 | Efficient FORTRAN Subprograms for the Solution of Separable Elliptic 4 | Partial Differential Equations 5 | 6 | 12/06/2011 7 | 8 | Authors: John Adams, Paul Swarztrauber and Roland Sweet 9 | 10 | CAVEAT 11 | ------ 12 | FISHPACK 4.1 is written in Fortran 77 but it does not fully comply with the 13 | Fortran 77 standard. It breaks the standard by calling routines with one type 14 | of argument and later uses the argument as another type. There may be other 15 | violations as well. Users whose applications require strict adherence to the 16 | standard should not use FISHPACK 4.1. 17 | 18 | Documentation 19 | ------------- 20 | Documentation for this software package is provided in file FISHPACK4.1.html 21 | and companion image file FISH.gif. We intend the document for display on your 22 | browser. 23 | 24 | Recent bugfixes 25 | --------------- 26 | None. This library is regarded as legacy, and no problems other than standards 27 | violations have been reported for several years. 28 | 29 | Compiling the Library and Test Programs 30 | --------------------------------------- 31 | Our Makefile requires gmake and a Fortran 90 compiler to make the library and test 32 | executables. It is configured to build a static library on several popular unix 33 | and unix-like operating systems; a Fortran compiler is required on the system where 34 | you are executing the Makefile. 35 | 36 | Examine file make.inc to see if your OS and compiler are represented. If they 37 | are not, you should modify file make.inc and the Makefile in each directory 38 | (main, src and test) so that they are represented. 39 | 40 | The source code is primarily Fortran 77 syntax for single precision floating-point 41 | arithmetic. If you desire double precision, you should modify Makefile and make.inc 42 | with compiler options for promoting real to double precision. Your compiler's user 43 | guide will have information on the required compiler options. 44 | -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/src/fishpack4.1/src/Makefile: -------------------------------------------------------------------------------- 1 | SRC=blktri.f cblktri.f cmgnbn.f comf.f fftpack.f genbun.f gnbnaux.f \ 2 | hstcrt.f hstcsp.f hstcyl.f hstplr.f hstssp.f hw3crt.f hwscrt.f \ 3 | hwscsp.f hwscyl.f hwsplr.f hwsssp.f pois3d.f poistg.f sepaux.f \ 4 | sepeli.f sepx4.f 5 | 6 | OBJ=$(subst .f,.o,$(SRC)) 7 | OBJS=$(addprefix ../objs/,$(OBJ)) 8 | 9 | ../lib/libfishpack.a: $(OBJS) 10 | $(AR) -rv $@ $? 11 | 12 | ../objs/%.o : %.f 13 | $(FC) $(FCFLAGS) -c $< -o $@ 14 | 15 | clean: 16 | rm -f ../lib/libfishpack.a $(OBJS) 17 | -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/src/fishpack4.1/test/Makefile: -------------------------------------------------------------------------------- 1 | SRC=tblktri.f tcblktri.f tcmgnbn.f tgenbun.f thstcrt.f thstcsp.f thstcyl.f \ 2 | thstplr.f thstssp.f thw3crt.f thwscrt.f thwscsp.f thwscyl.f thwsplr.f \ 3 | thwsssp.f tpois3d.f tpoistg.f tsepeli.f tsepx4.f 4 | 5 | EXES=$(subst .f,.exe, $(SRC)) 6 | 7 | all : $(EXES) 8 | 9 | $(EXES) : $(SRC) 10 | 11 | %.exe : %.f 12 | rm -f $@ 13 | $(FC) $(FCFLAGS) $< -o $@ -L../lib -l fishpack 14 | ./$@ 15 | 16 | 17 | clean : 18 | rm -f $(EXES) 19 | rm -rf *.dSYM 20 | -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/src/include/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | ifort $(FCFLAGS) mkl_dfti.f90 mkl_poisson.f90 -c 3 | 4 | clean: 5 | rm -f *.mod *.o 6 | -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/src/jacobian.f90: -------------------------------------------------------------------------------- 1 | subroutine jacobian(Nx,Ny,psi,vis,jac_term) 2 | 3 | implicit none 4 | integer, intent(in) :: Nx,Ny 5 | real(8), dimension(Nx,Ny), intent(in) :: psi,vis 6 | real(8), dimension(Nx,Ny), intent(out) :: jac_term 7 | 8 | integer :: i,j 9 | 10 | jac_term(:,:) = 0.d0 11 | 12 | do i=2,Nx-1 13 | do j=2,Ny-1 14 | 15 | ! Arakawa Jacobian 16 | jac_term(i,j) = ((psi(i+1,j)-psi(i-1,j))*(vis(i,j+1)-vis(i,j-1)) & 17 | & -(psi(i,j+1)-psi(i,j-1))*(vis(i+1,j)-vis(i-1,j)) & 18 | & +psi(i+1,j)*(vis(i+1,j+1)-vis(i+1,j-1)) & 19 | & -psi(i-1,j)*(vis(i-1,j+1)-vis(i-1,j-1)) & 20 | & -psi(i,j+1)*(vis(i+1,j+1)-vis(i-1,j+1)) & 21 | & +psi(i,j-1)*(vis(i+1,j-1)-vis(i-1,j-1)) & 22 | & +vis(i,j+1)*(psi(i+1,j+1)-psi(i-1,j+1)) & 23 | & -vis(i,j-1)*(psi(i+1,j-1)-psi(i-1,j-1)) & 24 | & -vis(i+1,j)*(psi(i+1,j+1)-psi(i+1,j-1)) & 25 | & +vis(i-1,j)*(psi(i-1,j+1)-psi(i-1,j-1))) & 26 | & *0.33333333 27 | 28 | end do 29 | end do 30 | 31 | !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 32 | ! NOTE: For THIS Jacobian the BOUNDARY VALUES vanish everywhere, 33 | ! 34 | ! for BOTH free-slip and no-slip boundary conditions!!!!!!!!!!!!!!!! 35 | !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 36 | 37 | ! we ignore the interface boundaries here for the moment 38 | ! (vis and psi know about the boundaries ofcourse) 39 | ! since the boundary values of the jacobian are of no consequence atm 40 | ! otherwise we would need to add vis on the boundary as boundary condition!! 41 | 42 | end 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/src/wind.f90: -------------------------------------------------------------------------------- 1 | subroutine wind(Nm,Nx,Ny,windy) 2 | 3 | implicit none 4 | integer, intent(in) :: Nx,Ny,Nm 5 | real(8), dimension(Nm,Nx,Ny), intent(out) :: windy 6 | 7 | integer :: i,j,m 8 | real(8) :: pi = 3.14159265358979d0 9 | real(8), dimension(Nx,Ny) :: tau 10 | 11 | tau(:,:) = 0.d0 12 | windy(:,:,:) = 0.d0 13 | 14 | do i=1,Nx 15 | do j=1,Ny 16 | 17 | tau(i,j) = cos(2.*pi*((j-1.)/(Ny-1.)-0.5))+2.*sin(pi*((j-1.)/(Ny-1.)-0.5)) 18 | ! tau(i,j) = -1./(2.*pi)*cos(2.*pi*(j-1.)/(Ny-1.)) 19 | ! tau(i,j) = -cos(pi*(j-1.)/(Ny-1.)) 20 | ! tau(i,j) = -cos(pi*(j-1.5)/(ny-2.)) ! what they had in the code 21 | ! tau(i,j) = -1./pi*cos(pi*(j-1.)/(Ny-1.)) ! what I used 22 | ! tau(i,j) = -1./pi*cos(pi*(j-1.)/(ny-1.))*sin(pi*(i-1.)/(ny-1.)) ! Veronis (1966) ???? 23 | 24 | end do 25 | end do 26 | 27 | do m=1,Nm 28 | do i=2,Nx-1 29 | do j=2,Ny-1 30 | 31 | windy(m,i,j) = -tau(i,j+1)+tau(i,j-1) ! include the whole curl, i.e., also x-derivative for generality ????? 32 | 33 | end do 34 | end do 35 | end do 36 | 37 | ! write(*,*) tau 38 | ! write(*,*) windy 39 | 40 | end 41 | 42 | 43 | ! real(8), allocatable, dimension (:,:) :: wind_term 44 | ! allocate (wind_term(Nx,Ny)) 45 | ! call wind(Nx,Ny,wind_term) 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/omuse/community/qgmodel/viebahn2014.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | from os import path 4 | 5 | from interface import QGmodel,single_gyre_wind_model 6 | 7 | from amuse.units import units 8 | 9 | from matplotlib import pyplot 10 | 11 | from amuse.io import write_set_to_file 12 | 13 | def viebahn2014(N=50,reynolds_number=1,dm=0.04): 14 | 15 | beta0=1.8616e-11 |(units.m * units.s)**-1 16 | L=1.e6 | units.m 17 | H=4000.| units.m 18 | rho=1000. | units.kg/units.m**3 19 | dx=L/N 20 | 21 | A_H=beta0*(dm*L)**3 22 | tau=reynolds_number*A_H*rho*beta0*H 23 | U=tau/beta0/rho/H/L 24 | delta_m=(A_H/beta0)**(1./3)/L 25 | delta_i=(U/beta0)**0.5/L 26 | timescale=1./(beta0*L) 27 | 28 | print("Viebahn 2014 setup") 29 | print("N=%i, Reynolds_number=%f"%(N,reynolds_number)) 30 | print("dm (derived):", (A_H/beta0)**(1./3)/L) 31 | print("tau:", tau.value_in(units.Pa)) 32 | print("A:", A_H) 33 | print("timescale:", timescale.in_(units.s)) 34 | print("delta_m:", delta_m) 35 | print("delta_i:", delta_i) 36 | 37 | qg=QGmodel(redirection="none") 38 | 39 | qg.parameters.Lx=L 40 | qg.parameters.Ly=L 41 | qg.parameters.dx=dx 42 | qg.parameters.dy=dx 43 | qg.parameters.dt=900 | units.s 44 | qg.parameters.A_H=A_H 45 | qg.parameters.interface_wind=True 46 | qg.parameters.rho=rho 47 | qg.parameters.beta0=beta0 48 | qg.parameters.ocean_depth=H 49 | qg.parameters.tau=tau 50 | 51 | def wind_function(x,y): 52 | return single_gyre_wind_model(x,y,L,tau) 53 | 54 | qg.set_wind(wind_function) 55 | 56 | return qg 57 | 58 | 59 | def evolve_to_eq(qg,f=0.01,label=""): 60 | 61 | dtplot=10.| units.day 62 | 63 | psi=qg.grid[:,:,0].psi 64 | for i in range(101): 65 | tend=i*dtplot 66 | 67 | qg.evolve_model(tend) 68 | prev=psi 69 | psi=qg.grid[:,:,0].psi 70 | 71 | d=abs(psi-prev).sum()/psi.sum() 72 | print(i,d) 73 | if d<0.01: break 74 | 75 | write_set_to_file(qg.grid,"viebahn2014_grid"+label,"amuse") 76 | 77 | if __name__=="__main__": 78 | sys=viebahn2014(400,20.) 79 | evolve_to_eq(sys,label="_reference") 80 | -------------------------------------------------------------------------------- /src/omuse/community/swan/Makefile: -------------------------------------------------------------------------------- 1 | ifeq ($(origin AMUSE_DIR), undefined) 2 | AMUSE_DIR := $(shell amusifier --get-amuse-dir) 3 | endif 4 | -include ${AMUSE_DIR}/config.mk 5 | 6 | CLASSNAME=SwanInterface 7 | 8 | FCFLAGS+= -O2 9 | 10 | FCFLAGS+=$(OPENMP_FCFLAGS) 11 | 12 | FCINCS = -I./src/ -I./src/work/ 13 | 14 | all: src/libamuse_swan.a src/amuse_swan.o swan_worker 15 | 16 | src/libamuse_swan.a: 17 | make -C src/ libamuse_swan.a MPIFC="$(MPIFC)" 18 | 19 | src/amuse_swan.o: src/libamuse_swan.a src/amuse_swan.ftn90 20 | make -C src/ amuse_swan.o MPIFC="$(MPIFC)" 21 | 22 | worker_code.f90: interface.py 23 | amusifier --type=f90 $< $(CLASSNAME) -o $@ 24 | 25 | swan_worker: worker_code.f90 interface.o src/amuse_swan.o src/libamuse_swan.a 26 | $(MPIFC) $(FCFLAGS) $(FCINCS) $(SC_FLAGS) $(FS_FLAGS) $^ -o $@ $(LIBS) $(SC_FCLIBS) $(FS_LIBS) 27 | 28 | %.o: %.f90 29 | $(FC) $(FCFLAGS) $(FCINCS) -c -o $@ $< 30 | 31 | interface.o: interface.f90 getter_setters.f90 src/amuse_swan.o src/libamuse_swan.a 32 | $(FC) $(FCFLAGS) $(FCINCS) -c -o $@ interface.f90 33 | 34 | getter_setters.f90: interface.py 35 | python -c "import interface; interface.generate_getters_setters()" 36 | 37 | clean: 38 | make -C src/ clean 39 | rm -f *.pyc *.mod 40 | rm -f interface.o swan_worker.f90 worker_code.f90 41 | rm -f swan_worker 42 | 43 | distclean: clean 44 | make -C src/ distclean 45 | -------------------------------------------------------------------------------- /src/omuse/community/swan/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/swan/__init__.py -------------------------------------------------------------------------------- /src/omuse/community/swan/src/Makefile: -------------------------------------------------------------------------------- 1 | FC ?= gfortran 2 | MPIFC ?= $(FC) 3 | 4 | .PHONY: patch apply_patch apply_reverse_patch config code objects 5 | 6 | libamuse_swan.a: work config objects 7 | ar crs $@ work/*.o 8 | 9 | amuse_swan.o: amuse_swan.f90 10 | $(FC) -Iwork $(FCFLAGS) -c -o $@ $< 11 | 12 | amuse_swan.f90: work amuse_swan.ftn90 13 | $(eval $(shell grep 'swch =' macros.inc)) 14 | perl work/switch.pl $(swch) amuse_swan.ftn90 15 | 16 | config: work 17 | cp macros.inc work/macros.inc 18 | 19 | objects: config apply_patch 20 | make -C work amuse MPIFC="$(MPIFC)" 21 | 22 | code: config apply_reverse_patch 23 | make -C work/ ser MPIFC="$(MPIFC)" 24 | 25 | work: 26 | cp -r swan work 27 | 28 | apply_patch: 29 | -cd work; patch -N -p1 < ../swan.patch 30 | 31 | apply_reverse_patch: 32 | -cd work; patch -N -p1 -R < ../swan.patch 33 | 34 | patch: clean 35 | diff -uN swan work > new.patch || exit 0 36 | 37 | clean: 38 | rm -f *.mod *.o libamuse_swan.a 39 | make -C work/ clobber 40 | 41 | distclean: clean 42 | rm -rf work 43 | -------------------------------------------------------------------------------- /src/omuse/community/swan/src/macros.inc: -------------------------------------------------------------------------------- 1 | # template for amuse 2 | 3 | ifeq ($(findstring gfortran, $(notdir $(FC))), gfortran) 4 | FCFLAGS += -fno-second-underscore -std=legacy 5 | OMPFLAG = -fopenmp 6 | F90FLAGS = -ffree-line-length-none 7 | endif 8 | 9 | ifeq ($(findstring ifort, $(notdir $(FC))), ifort) 10 | FCFLAGS += -W0 -assume byterecl -traceback -diag-disable 8290 -diag-disable 8291 -diag-disable 8293 11 | OMPFLAG = -openmp 12 | F90FLAGS = 13 | endif 14 | 15 | F90_SER = $(FC) 16 | F90_OMP = $(FC) 17 | F90_MPI = $(MPIFC) 18 | FLAGS_OPT = -O2 19 | FLAGS_MSC = $(FCFLAGS) 20 | FLAGS90_MSC = $(FLAGS_MSC) $(F90FLAGS) 21 | FLAGS_SER = 22 | FLAGS_OMP = $(OMPFLAG) 23 | FLAGS_MPI = 24 | NETCDFROOT = 25 | INCS_SER = 26 | INCS_OMP = 27 | INCS_MPI = 28 | LIBS_SER = 29 | LIBS_OMP = 30 | LIBS_MPI = 31 | NCF_OBJS = 32 | O_DIR = ../work/odir4/ 33 | OUT = -o 34 | EXTO = o 35 | MAKE = make 36 | RM = rm -f 37 | swch = -unix 38 | -------------------------------------------------------------------------------- /src/omuse/community/swan/src/swan.patch: -------------------------------------------------------------------------------- 1 | diff -uN swan/Makefile work/Makefile 2 | --- swan/Makefile 2015-10-19 12:51:48.919650461 +0200 3 | +++ work/Makefile 2015-12-16 14:17:35.221693866 +0100 4 | @@ -135,6 +135,12 @@ 5 | FFLAGS90="$(FLAGS_OPT) $(FLAGS90_MSC) $(FLAGS_SER)" \ 6 | INCS="$(INCS_SER)" LIBS="$(LIBS_SER)" OBJS="$(SWAN_OBJS)" $(SWAN_EXE) 7 | 8 | +amuse: 9 | + @perl switch.pl $(swch) *.ftn *.ftn90 10 | + $(MAKE) FOR=$(F90_SER) FFLAGS="$(FLAGS_OPT) $(FLAGS_MSC) $(FLAGS_SER)" \ 11 | + FFLAGS90="$(FLAGS_OPT) $(FLAGS90_MSC) $(FLAGS_SER)" \ 12 | + INCS="$(INCS_SER)" LIBS="$(LIBS_SER)" OBJS="$(SWAN_OBJS)" objects 13 | + 14 | omp: 15 | @perl switch.pl $(swch) *.ftn *.ftn90 16 | $(MAKE) FOR=$(F90_OMP) FFLAGS="$(FLAGS_OPT) $(FLAGS_MSC) $(FLAGS_OMP)" \ 17 | @@ -182,6 +188,8 @@ 18 | $(SWAN_EXE): $(SWAN_OBJS) 19 | $(FOR) $(OBJS) $(FFLAGS) $(OUT)$(SWAN_EXE) $(INCS) $(LIBS) 20 | 21 | +objects: $(SWAN_OBJS) 22 | + 23 | .f.o: 24 | $(FOR) $< -c $(FFLAGS) $(INCS) 25 | 26 | diff -uN swan/ocpids.ftn work/ocpids.ftn 27 | --- swan/ocpids.ftn 2015-10-19 12:51:48.948650462 +0200 28 | +++ work/ocpids.ftn 2015-12-16 14:18:12.987692286 +0100 29 | @@ -182,7 +182,7 @@ 30 | ! REFERENCE NUMBERS AND NAMES OF STANDARD FILES 31 | ! 32 | INPUTF = 3 33 | - INPFIL = 'INPUT' 34 | + INPFIL = ' ' 35 | PRINTF = 4 36 | OUTFIL = 'PRINT' 37 | ! unit ref. numbers for output to screen and to separate 38 | diff -uN swan/swanmain.ftn work/swanmain.ftn 39 | --- swan/swanmain.ftn 2015-10-19 12:51:48.963650461 +0200 40 | +++ work/swanmain.ftn 2015-12-16 14:17:35.223693866 +0100 41 | @@ -26,7 +26,7 @@ 42 | ! 43 | !*********************************************************************** 44 | ! * 45 | -!NADC PROGRAM SWAN 46 | +!NADC SUBROUTINE SWAN 47 | !ADC SUBROUTINE SWAN 48 | ! * 49 | !*********************************************************************** 50 | diff -uN swan/SwanPrepComp.ftn90 work/SwanPrepComp.ftn90 51 | --- swan/SwanPrepComp.ftn90 2015-10-19 12:51:48.933650463 +0200 52 | +++ work/SwanPrepComp.ftn90 2015-12-16 14:17:35.223693866 +0100 53 | @@ -76,8 +76,8 @@ 54 | !PUN ! 55 | ! deallocate arrays kvertc and kvertf (we don't use them anymore!) 56 | ! 57 | - if (allocated(kvertc)) deallocate(kvertc) 58 | - if (allocated(kvertf)) deallocate(kvertf) 59 | +! if (allocated(kvertc)) deallocate(kvertc) 60 | +! if (allocated(kvertf)) deallocate(kvertf) 61 | ! 62 | !PUN ! ghost vertices are regarded as vertices with boundary condition 63 | !PUN ! 64 | -------------------------------------------------------------------------------- /src/omuse/community/swan/src/swan/SwanCompdata.ftn90: -------------------------------------------------------------------------------- 1 | module SwanCompdata 2 | ! 3 | ! --|-----------------------------------------------------------|-- 4 | ! | Delft University of Technology | 5 | ! | Faculty of Civil Engineering and Geosciences | 6 | ! | Environmental Fluid Mechanics Section | 7 | ! | P.O. Box 5048, 2600 GA Delft, The Netherlands | 8 | ! | | 9 | ! | Programmer: Marcel Zijlema | 10 | ! --|-----------------------------------------------------------|-- 11 | ! 12 | ! 13 | ! SWAN (Simulating WAves Nearshore); a third generation wave model 14 | ! Copyright (C) 1993-2014 Delft University of Technology 15 | ! 16 | ! This program is free software; you can redistribute it and/or 17 | ! modify it under the terms of the GNU General Public License as 18 | ! published by the Free Software Foundation; either version 2 of 19 | ! the License, or (at your option) any later version. 20 | ! 21 | ! This program is distributed in the hope that it will be useful, 22 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 | ! GNU General Public License for more details. 25 | ! 26 | ! A copy of the GNU General Public License is available at 27 | ! http://www.gnu.org/copyleft/gpl.html#SEC3 28 | ! or by writing to the Free Software Foundation, Inc., 29 | ! 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 | ! 31 | ! 32 | ! Authors 33 | ! 34 | ! 40.80: Marcel Zijlema 35 | ! 40.92: Marcel Zijlema 36 | ! 37 | ! Updates 38 | ! 39 | ! 40.80, July 2007: New Module 40 | ! 40.92, June 2008: changes with respect to boundary polygons 41 | ! 42 | ! Purpose 43 | ! 44 | ! Module containing data for computation with unstructured grid 45 | ! 46 | ! Method 47 | ! 48 | ! Data based on unstructured grid 49 | ! 50 | ! Modules used 51 | ! 52 | use swcomm3 53 | ! 54 | implicit none 55 | ! 56 | ! Module parameters 57 | ! 58 | ! 59 | ! Module variables 60 | ! 61 | integer :: nbpol ! total number of boundary polygons 62 | integer, dimension(10000) :: nbpt ! number of boundary vertices for each boundary polygon 63 | ! 64 | integer, dimension(MICMAX) :: vs ! computational stencil, i.e. set of vertices 65 | ! needed for the computation of a new value 66 | ! in the present vertex 67 | !$omp threadprivate(vs) 68 | ! 69 | integer, dimension(:,:), save, allocatable :: blist ! list of boundary vertices in ascending order for each boundary polygon 70 | integer, dimension(:) , save, allocatable :: vlist ! vertex list 71 | ! 72 | ! Source text 73 | ! 74 | end module SwanCompdata 75 | -------------------------------------------------------------------------------- /src/omuse/community/swan/src/swan/SwanSumOverNodes.ftn90: -------------------------------------------------------------------------------- 1 | subroutine SwanSumOverNodes ( rval ) 2 | ! 3 | ! --|-----------------------------------------------------------|-- 4 | ! | Delft University of Technology | 5 | ! | Faculty of Civil Engineering and Geosciences | 6 | ! | Environmental Fluid Mechanics Section | 7 | ! | P.O. Box 5048, 2600 GA Delft, The Netherlands | 8 | ! | | 9 | ! | Programmer: Marcel Zijlema | 10 | ! --|-----------------------------------------------------------|-- 11 | ! 12 | ! 13 | ! SWAN (Simulating WAves Nearshore); a third generation wave model 14 | ! Copyright (C) 1993-2014 Delft University of Technology 15 | ! 16 | ! This program is free software; you can redistribute it and/or 17 | ! modify it under the terms of the GNU General Public License as 18 | ! published by the Free Software Foundation; either version 2 of 19 | ! the License, or (at your option) any later version. 20 | ! 21 | ! This program is distributed in the hope that it will be useful, 22 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 | ! GNU General Public License for more details. 25 | ! 26 | ! A copy of the GNU General Public License is available at 27 | ! http://www.gnu.org/copyleft/gpl.html#SEC3 28 | ! or by writing to the Free Software Foundation, Inc., 29 | ! 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 | ! 31 | ! 32 | ! Authors 33 | ! 34 | ! 40.95: Marcel Zijlema 35 | ! 36 | ! Updates 37 | ! 38 | ! 40.95, July 2008: New subroutine 39 | ! 40 | ! Purpose 41 | ! 42 | ! Performs a global sum of reals over all nodes 43 | ! 44 | ! Modules used 45 | ! 46 | use ocpcomm4 47 | !PUN use SIZES, only: MNPROC 48 | !PUN use GLOBAL, only: COMM 49 | !PUN use MESSENGER, only: IERR 50 | !PUN use mpi 51 | ! 52 | implicit none 53 | ! 54 | ! Argument variables 55 | ! 56 | real, intent(inout) :: rval ! input value 57 | ! 58 | ! Local variables 59 | ! 60 | integer :: count ! length of array to be collect 61 | integer, save :: ient = 0 ! number of entries in this subroutine 62 | real :: sumval ! sum total of all input values from all subdomains 63 | ! 64 | ! Structure 65 | ! 66 | ! Description of the pseudo code 67 | ! 68 | ! Source text 69 | ! 70 | if (ltrace) call strace (ient,'SwanSumOverNodes') 71 | ! 72 | ! if not parallel, return 73 | ! 74 | !PUN if ( MNPROC==1 ) return 75 | ! 76 | !TIMG call SWTSTA(202) 77 | sumval = 0. 78 | count = 1 79 | !PUN call MPI_ALLREDUCE ( rval, sumval, count, MPI_REAL4, MPI_SUM, COMM, IERR ) 80 | ! 81 | rval = sumval 82 | !TIMG call SWTSTO(202) 83 | ! 84 | end subroutine SwanSumOverNodes 85 | -------------------------------------------------------------------------------- /src/omuse/community/swan/src/swan/hcat.nml: -------------------------------------------------------------------------------- 1 | &arg_nml !namelist identifier 2 | basefile = "hotfile_example", !(required) base file name (w/o mpi node tag) 3 | free = .true. !(optional) free format (default .true.) 4 | halo = 3, !(optional) halo size (default is 3) 5 | verbose = .false., !(optional) verbose screen ouput (default .false.) 6 | stomp = .false. !(optional) overwrite basefile (default .false.) 7 | / !end-of-namelist marker 8 | -------------------------------------------------------------------------------- /src/omuse/community/swan/src/swan/m_constants.ftn90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | module m_constants 3 | !------------------------------------------------------------------------------ 4 | ! 5 | ! physical constants 6 | ! 7 | real sqrtg ! square root of grav 8 | real gsq ! square of grav 9 | real nu ! kinematic viscosity of water 10 | ! 11 | real d_water ! density of water 12 | real d_air ! density of air 13 | ! 14 | real trshdep ! treshold depth (=DEPMIN as given by SWAN) 15 | ! 16 | ! mathematical constants 17 | ! 18 | real pih ! pi/2 19 | real dera ! conversion from degrees to radians 20 | real rade ! conversion from radians to degrees 21 | real expmin ! min argument for exp. function to avoid underflow 22 | real expmax ! max argument for exp. function to avoid overflow 23 | real sqrt2 ! square root of 2 ~ 1.41 24 | ! 25 | contains 26 | ! 27 | !------------------------------------------------------------------------------ 28 | subroutine init_constants 29 | !------------------------------------------------------------------------------ 30 | ! 31 | use SWCOMM3 32 | ! 33 | pih = 0.5*PI 34 | dera = PI/180. 35 | rade = 180./PI 36 | ! 37 | expmin = -20. 38 | expmax = 20. 39 | ! 40 | ! physical constants 41 | ! 42 | sqrtg = sqrt(GRAV) 43 | gsq = GRAV*GRAV 44 | nu = 1.e-6 45 | d_air = PWIND(16) 46 | d_water = PWIND(17) 47 | ! 48 | trshdep = DEPMIN 49 | ! 50 | end subroutine 51 | ! 52 | end module 53 | -------------------------------------------------------------------------------- /src/omuse/community/swan/src/swan/machinefile: -------------------------------------------------------------------------------- 1 | # This file lists the names of the node that together form the 2 | # parallel computer to be used. 3 | # Put one node per line in the file. You can specify a number 4 | # after the node name to indicate how many processes to launch 5 | # on the node. 6 | # The run procedure will cycle through this list until all the 7 | # requested processes are launched. 8 | -------------------------------------------------------------------------------- /src/omuse/community/swan/src/swan/macros.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/community/swan/src/swan/macros.inc -------------------------------------------------------------------------------- /src/omuse/community/swan/src/swan/plotgrid.m: -------------------------------------------------------------------------------- 1 | function plotgrid(basename); 2 | % Plots unstructured grid generated by TRIANGLE 3 | % 4 | % Example: 5 | % 6 | % TRIANGLE generated files with basename 'f32hari', e.g. 'f32hari.node' and 'f32hari.ele' 7 | % To make a plot of the unstructured grid, give the following command in Matlab: 8 | % 9 | % plotgrid('f32hari') 10 | % 11 | % 12 | % Author : Marcel Zijlema 13 | % Date : February 13, 2008 14 | % Version : 1.0 15 | 16 | if nargin~=1 17 | error('Wrong number of arguments. See "help plotgrid"') 18 | end 19 | 20 | nodefile=[basename '.node']; 21 | elefile=[basename '.ele']; 22 | fid = fopen(nodefile); % load TRIANGLE vertex based connectivity file 23 | [nnode] = fscanf(fid,'%i',[1 4]); % get number of nodes 24 | ncol = 3+nnode(3)+nnode(4); % specify number of columns in nodefile 25 | data = fscanf(fid,'%f',[ncol nnode(1)])'; % get data 26 | x=data(:,2); y=data(:,3); % get coordinates 27 | fid = fopen(elefile); % load TRIANGLE element based connectivity file 28 | [nelem] = fscanf(fid,'%i',[1 3]); % get number of triangles 29 | ncol = 4+nelem(3); % specify number of columns in elefile 30 | tri = fscanf(fid,'%i',[ncol nelem(1)])'; % get connectivity table 31 | trimesh(tri(:,2:4),x,y, zeros(size(x)), ... % make grid using trimesh 32 | 'EdgeColor', 'k', ... 33 | 'FaceColor', 'none', ... 34 | 'LineWidth', 0.5) 35 | view(2) % make 2D view 36 | axis equal % equal axes 37 | -------------------------------------------------------------------------------- /src/omuse/community/swan/src/swan/plotunswan.m: -------------------------------------------------------------------------------- 1 | function plotunswan(matfile,basename,wavepar); 2 | % Plots a wave parameter on unstructured grid 3 | % 4 | % Example: 5 | % 6 | % SWAN generated a binary Matlab file called 'f32har01.mat' 7 | % TRIANGLE generated files with basename 'f32hari', e.g. 'f32hari.ele' 8 | % To make a plot of the significant wave height, give the following 9 | % command in Matlab: 10 | % 11 | % plotunswan('f32har01','f32hari','Hsig') 12 | % 13 | % For other wave parameters, type the following command: 14 | % 15 | % who -file f32har01 16 | % 17 | % 18 | % Author : Marcel Zijlema 19 | % Date : February 13, 2008 20 | % Version : 1.0 21 | 22 | if nargin~=3 23 | error('Wrong number of arguments. See "help plotunswan"') 24 | end 25 | 26 | eval(['load ' matfile]); % load binary file containing SWAN results 27 | % obtained using BLOCK command with COMPGRID-set 28 | elefile=[basename '.ele']; 29 | fid = fopen(elefile); % load TRIANGLE element based connectivity file 30 | [nelem] = fscanf(fid,'%i',[1 3]); % get number of triangles 31 | ncol = 4+nelem(3); % specify number of columns in elefile 32 | tri = fscanf(fid,'%i',[ncol nelem(1)])'; % get connectivity table 33 | z=eval([wavepar]); % get wave parameter 34 | trisurf(tri(:,2:4),Xp,Yp,z) % make plot using trisurf 35 | view(0,90);shading interp; % make 2D view and smooth plot 36 | colormap(jet);colorbar;axis equal % include colorbar and equal axes 37 | -------------------------------------------------------------------------------- /src/omuse/community/swan/src/swan/swanrun.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem 3 | rem swanrun.bat 4 | rem 5 | rem Run the SWAN program by means of the SWAN input file 6 | rem Note: it is assumed that the extension of the input file is '.swn' 7 | rem 8 | rem Usage: swanrun inputfile [nprocs] 9 | rem 10 | 11 | set nprocs=1 12 | 13 | if not "%1"=="" goto OK1 14 | echo. 15 | echo Usage: swanrun inputfile [nprocs] 16 | goto END 17 | :OK1 18 | 19 | set inputfile=%1 20 | shift 21 | 22 | if exist %inputfile%.swn goto OK2 23 | echo. 24 | echo Error: file %inputfile%.swn does not exist 25 | goto END 26 | :OK2 27 | 28 | if "%1"=="" goto OK3 29 | set nprocs=%1 30 | :OK3 31 | 32 | copy %inputfile%.swn INPUT >> nul 33 | 34 | if not %nprocs%==1 goto PARALLEL1 35 | swan.exe 36 | goto OK4 37 | 38 | :PARALLEL1 39 | mpiexec -n %nprocs% swan.exe 40 | 41 | :OK4 42 | if errorlevel 1 goto END 43 | 44 | if not %nprocs%==1 goto PARALLEL2 45 | if exist PRINT copy PRINT %inputfile%.prt >> nul 46 | if exist PRINT del PRINT 47 | goto OK5 48 | :PARALLEL2 49 | if not exist PRINT-001 goto OK5 50 | if %nprocs% GTR 9 goto RANGE1 51 | for /L %%i in (1,1,%nprocs%) do copy PRINT-00%%i %inputfile%.prt-00%%i >> nul 52 | for /L %%i in (1,1,%nprocs%) do del PRINT-00%%i 53 | goto OK5 54 | :RANGE1 55 | if %nprocs% GTR 99 goto RANGE2 56 | for /L %%i in (1,1,9) do copy PRINT-00%%i %inputfile%.prt-00%%i >> nul 57 | for /L %%i in (1,1,9) do del PRINT-00%%i 58 | for /L %%i in (10,1,%nprocs%) do copy PRINT-0%%i %inputfile%.prt-0%%i >> nul 59 | for /L %%i in (10,1,%nprocs%) do del PRINT-0%%i 60 | goto OK5 61 | :RANGE2 62 | if %nprocs% GTR 999 goto ERR 63 | for /L %%i in (1,1,9) do copy PRINT-00%%i %inputfile%.prt-00%%i >> nul 64 | for /L %%i in (1,1,9) do del PRINT-00%%i 65 | for /L %%i in (10,1,99) do copy PRINT-0%%i %inputfile%.prt-0%%i >> nul 66 | for /L %%i in (10,1,99) do del PRINT-0%%i 67 | for /L %%i in (100,1,%nprocs%) do copy PRINT-%%i %inputfile%.prt-%%i >> nul 68 | for /L %%i in (100,1,%nprocs%) do del PRINT-%%i 69 | goto OK5 70 | :ERR 71 | echo Error: too many processes 72 | goto END 73 | :OK5 74 | 75 | if exist Errfile copy Errfile %inputfile%.erf >> nul 76 | if exist Errfile del Errfile 77 | if exist ERRPTS copy ERRPTS %inputfile%.erp >> nul 78 | if exist ERRPTS del ERRPTS 79 | del INPUT 80 | if not exist norm_end goto END 81 | type norm_end 82 | 83 | :END 84 | 85 | set inputfile= 86 | set nprocs= 87 | -------------------------------------------------------------------------------- /src/omuse/community/swan/src/swan/which.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem found on http://superuser.com/questions/21067/windows-equivalent-of-whereis 3 | 4 | @echo off 5 | @set PATH=.;%PATH% 6 | 7 | @rem 8 | @rem about: something similar like the unix-alike-which, but with 9 | @rem within pure cmd 10 | @rem 11 | 12 | if "%1" == "" ( 13 | @echo Usage: 14 | @echo. 15 | @echo which 'cmd' 16 | @echo. 17 | @echo.if 'cmd' is not found, ERRORLEVEL is set to 1 18 | @echo. 19 | ) else ( 20 | ( @for %%f in (%1 %1.exe %1.cmd %1.bat %1.pif) do if not "%%~$PATH:f" == "" ( @echo %%~$PATH:f ) else @set ERRORLEVEL=1) 21 | ) 22 | -------------------------------------------------------------------------------- /src/omuse/community/swan/swaninit: -------------------------------------------------------------------------------- 1 | 4 version of initialisation file 2 | Delft University of Technology name of institute 3 | 3 command file ref. number 4 | command file name 5 | 4 print file ref. number 6 | PRINT print file name 7 | 4 test file ref. number 8 | test file name 9 | 6 screen ref. number 10 | 99 highest file ref. number 11 | $ comment identifier 12 | TAB character 13 | \ dir sep char in input file 14 | / dir sep char replacing previous one 15 | 1 default time coding option 16 | -------------------------------------------------------------------------------- /src/omuse/community/swan/test/f31har01.swn: -------------------------------------------------------------------------------- 1 | $*************************HEADING************************ 2 | $ 3 | PROJ 'F31har01' 'F31' 4 | $ 5 | $ Field case: the Haringvliet test 6 | $ Time of simulation: 21:00 UTC on October 14, 1982 7 | $ 8 | $********************MODEL INPUT************************* 9 | $ 10 | SET LEVEL 0.30 11 | $ 12 | CGRID 6960.2 0. 0. 14789.8 22000. 98 88 CIRCLE 36 0.0521 1. 31 13 | $ 14 | $ NOTE: use exception value (-99 in this case) here to get 15 | $ good load balancing! 16 | INPGRID BOTTOM 0. 0. 0. 87 116 250. 250. EXC -99. 17 | READINP BOTTOM 1. 'f31hari.bot' 3 0 FREE 18 | $ 19 | WIND 12. 8.8 20 | $ 21 | BOU SIDE W CCW CON FILE 'f31har01.bnd' 1 22 | $ 23 | GEN3 24 | BREAKING 25 | FRICTION 26 | TRIADS 27 | $ 28 | $************************************************************* 29 | $ 30 | POINTS 'BUOYS' FILE 'f31hari.loc' 31 | TABLE 'BUOYS' HEAD 'f31har01.tab' DIST DEP HS RTP TM01 TM02 FSPR DIR FORCE 32 | TABLE 'BUOYS' NOHEAD 'f31har01.tbl' HS RTP TM01 TM02 FSPR 33 | SPEC 'BUOYS' SPEC1D 'f31har01.spc' 34 | $ 35 | $ generate binary Matlab-file for block-output 36 | BLOCK 'COMPGRID' NOHEAD 'f31har01.mat' LAYOUT 3 HS TM01 FSPR 37 | $ 38 | $ set itest=1 in order to get detailed information 39 | TEST 1,0 40 | COMPUTE 41 | STOP 42 | -------------------------------------------------------------------------------- /src/omuse/community/swan/test/plot_data.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | from matplotlib import pyplot 4 | 5 | data=numpy.load("data.npz") 6 | 7 | print data.files 8 | 9 | ac2=data['ac2'] 10 | 11 | mxc,myc,mdc,msc=ac2.shape 12 | fhigh=1. 13 | flow=0.0512 14 | 15 | 16 | thetas=numpy.arange(mdc+1)*2*numpy.pi/mdc 17 | fac=(fhigh/flow)**(1./(msc-1)) 18 | fs=flow*fac**numpy.arange(msc) 19 | 20 | print fs 21 | print thetas 22 | 23 | f,theta=numpy.meshgrid(fs,thetas) 24 | 25 | print theta.shape,f.shape,ac2[0,0,:,:].shape 26 | 27 | x=f*numpy.cos(theta) 28 | y=f*numpy.sin(theta) 29 | 30 | pyplot.ion() 31 | pyplot.figure(figsize=(10,10)) 32 | pyplot.show() 33 | iy=50 34 | ix=20 35 | for iy in range(myc): 36 | print ix,iy 37 | pyplot.clf() 38 | pyplot.pcolormesh(x,y,ac2[ix,iy,:,:]) 39 | pyplot.draw() 40 | 41 | raw_input() 42 | 43 | #~ pyplot.imshow(ac2[0,0,:,:], origin="lower") 44 | #~ 45 | #~ pyplot.show() 46 | -------------------------------------------------------------------------------- /src/omuse/community/swan/test/swaninit: -------------------------------------------------------------------------------- 1 | 4 version of initialisation file 2 | Delft University of Technology name of institute 3 | 3 command file ref. number 4 | command file name 5 | 4 print file ref. number 6 | PRINT print file name 7 | 4 test file ref. number 8 | test file name 9 | 6 screen ref. number 10 | 99 highest file ref. number 11 | $ comment identifier 12 | TAB character 13 | \ dir sep char in input file 14 | / dir sep char replacing previous one 15 | 1 default time coding option 16 | -------------------------------------------------------------------------------- /src/omuse/ext/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/ext/__init__.py -------------------------------------------------------------------------------- /src/omuse/ext/_seawater/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/ext/_seawater/README -------------------------------------------------------------------------------- /src/omuse/ext/_seawater/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/ext/_seawater/__init__.py -------------------------------------------------------------------------------- /src/omuse/ext/_seawater/density.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/ext/_seawater/density.py -------------------------------------------------------------------------------- /src/omuse/ext/_seawater/heat.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/ext/_seawater/heat.py -------------------------------------------------------------------------------- /src/omuse/ext/_seawater/misc.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/ext/_seawater/misc.py -------------------------------------------------------------------------------- /src/omuse/ext/_seawater/salinity.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/ext/_seawater/salinity.py -------------------------------------------------------------------------------- /src/omuse/ext/_seawater/test.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/ext/_seawater/test.py -------------------------------------------------------------------------------- /src/omuse/ext/eddy_tracker/SSH_t.t0.1_42l_nccs01.avg0315-0325.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/ext/eddy_tracker/SSH_t.t0.1_42l_nccs01.avg0315-0325.nc -------------------------------------------------------------------------------- /src/omuse/ext/eddy_tracker/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/src/omuse/ext/eddy_tracker/__init__.py -------------------------------------------------------------------------------- /src/omuse/ext/eddy_tracker/haversine_distmat_python.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | 4 | def get_haversine(lon1, lat1, lon2, lat2, d2r): 5 | 6 | dlat = d2r * (lat2 - lat1) 7 | dlon = d2r * (lon2 - lon1) 8 | lt1 = d2r * lat1 9 | lt2 = d2r * lat2 10 | 11 | # a = np.sin(0.5 * dlon) * np.sin(0.5 * dlon) 12 | # a = a * np.cos(lt1) * np.cos(lt2) 13 | # a = a + (np.sin(0.5 * dlat) * np.sin(0.5 * dlat)) 14 | # thedist = 2.0 * np.arctan2(np.sqrt(a), np.sqrt(1.0 - a)) 15 | 16 | a = np.sin(0.5 * dlon) * np.sin(0.5 * dlon) * \ 17 | np.cos(lt1) * np.cos(lt2) + \ 18 | (np.sin(0.5 * dlat) * np.sin(0.5 * dlat)) 19 | thedist = 2.0 * np.arctan2(np.sqrt(a), np.sqrt(1.0 - a)) 20 | 21 | return thedist 22 | 23 | 24 | 25 | def distance_vector(lon1, lat1, lon2, lat2): 26 | 27 | erad = 6371315.0 28 | d2r = np.arctan2(0.,-1.)/ 180. # atan2(0.,-1.) == pi 29 | 30 | m = np.shape(lon1)[0] 31 | 32 | dist = np.zeros((m)) 33 | for i in range(m): 34 | dist[i] = get_haversine(lon1[i], lat1[i], lon2[i], lat2[i], d2r) 35 | 36 | dist = dist * erad 37 | 38 | return dist 39 | 40 | 41 | 42 | def distance_matrix(xa, xb): 43 | 44 | erad = 6371315.0 45 | d2r = np.arctan2(0.,-1.)/ 180. # atan2(0.,-1.) == pi 46 | 47 | m = np.shape(xa)[1] #changed by Ben, used to be 0 48 | n = np.shape(xb)[1] #changed by Ben, used to be 0 49 | 50 | dist = np.zeros((m,n)) 51 | 52 | for j in range(m): 53 | #for i in range(n): 54 | #dist[j,i] = get_haversine(xa[j,0], xa[j,1], xb[i,0], xb[i,1],d2r) #fiona probably had xa and xb zipped 55 | #dist[j,i] = get_haversine(xa[0,j], xa[1,j], xb[0,i], xb[1,i], d2r) #first edit by Ben 56 | dist[j,:] = get_haversine(xa[0,j], xa[1,j], xb[0,:], xb[1,:], d2r) #Ben's attempt to do entire row at once 57 | 58 | 59 | 60 | 61 | dist = dist * erad 62 | 63 | return dist 64 | 65 | 66 | def distance(lon1, lat1, lon2, lat2): 67 | 68 | erad = 6371315.0 69 | d2r = np.arctan2(0.,-1.)/ 180. # atan2(0.,-1.) == pi 70 | 71 | thedist = get_haversine(lon1, lat1, lon2, lat2, d2r) 72 | thedist = thedist * erad 73 | 74 | return thedist 75 | -------------------------------------------------------------------------------- /src/omuse/ext/spherical_geometry.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from omuse.units import units 3 | from amuse.units import trigo 4 | 5 | sin=trigo.sin 6 | cos=trigo.cos 7 | tan=trigo.tan 8 | atan2=trigo.arctan2 9 | atan=trigo.arctan 10 | sqrt=numpy.sqrt 11 | 12 | def distance(lat1, lon1, lat2, lon2, R=1): 13 | """ 14 | returns the spherical distance between two coordinates in given in lat,lon 15 | result should be multiplied by R for the actual distance in meters 16 | """ 17 | 18 | dlat = lat2-lat1 19 | dlon = lon2-lon1 20 | 21 | #using haversine formula 22 | a = sin(dlat/2.0) * sin(dlat/2.0) + \ 23 | cos(lat1) * cos(lat2) * \ 24 | sin(dlon/2.0) * sin(dlon/2) 25 | 26 | d = 2 * atan2(sqrt(a), sqrt(1.0-a)) 27 | 28 | return R*d 29 | 30 | def triangle_area(a, b, c, R=1): 31 | """ 32 | returns the area of the triangle enclosed by three lines of distances a, b, and c 33 | result should be multiplied with R**2 for the actual surface area in meters 34 | """ 35 | 36 | #compute the semiperimeter 37 | s = (a + b + c)/2 38 | 39 | #compute spherical excess using L'Huilier's Theorem 40 | tans = tan(s/2) 41 | tana = tan((s-a)/2) 42 | tanb = tan((s-b)/2) 43 | tanc = tan((s-c)/2) 44 | 45 | tanE4 = sqrt(tans * tana * tanb * tanc) 46 | 47 | E = 4 * atan(tanE4) 48 | 49 | return R**2*E 50 | 51 | if __name__=="__main__": 52 | R=1| units.Rearth 53 | lon1=0. | units.deg 54 | lat1=0. | units.deg 55 | lon2=1. | units.deg 56 | lat2=0. | units.deg 57 | print(distance(lat1,lon1,lat2,lon2, R=R).in_(units.km)) 58 | 59 | lon1=0. | units.deg 60 | lat1=0. | units.deg 61 | lon2=90. | units.deg 62 | lat2=0. | units.deg 63 | lon3=0. | units.deg 64 | lat3=90. | units.deg 65 | d1=distance(lat1,lon1,lat2,lon2) 66 | d2=distance(lat2,lon2,lat3,lon3) 67 | d3=distance(lat3,lon3,lat1,lon1) 68 | print(d1,d2,d3) 69 | print(triangle_area(d1,d2,d3,R=R)/4/trigo.pi/R**2) 70 | -------------------------------------------------------------------------------- /src/omuse/io/__init__.py: -------------------------------------------------------------------------------- 1 | from amuse.io import * 2 | 3 | from .pop_netcdf import POPNetCDFFileFormatProcessor 4 | -------------------------------------------------------------------------------- /src/omuse/io/pop_netcdf.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | from netCDF4 import Dataset 4 | 5 | from amuse.io import base 6 | from omuse.units import units 7 | 8 | from amuse.datamodel import Grid 9 | 10 | celsius=units.K # placeholder 11 | 12 | units_lookup={ 13 | "cm/s" : units.cm/units.s, 14 | "dyne/cm2" : units.dyn/units.cm**2, 15 | "dyne/cm3" : units.dyn/units.cm**3, 16 | "deg C" : celsius, 17 | "msu (g/g)" : units.g/units.g, 18 | "cm2/s" : units.cm**2/units.s 19 | } 20 | 21 | class POPNetCDFFileFormatProcessor(base.FileFormatProcessor): 22 | def load(self): 23 | 24 | dataset=Dataset(self.filename) 25 | 26 | shape=() 27 | order=dict() 28 | for i,(key,d) in enumerate(dataset.dimensions.items()): 29 | shape+=(len(d),) 30 | order[key]=i 31 | 32 | grid=Grid(*shape[0:2]) 33 | 34 | for s in dataset.ncattrs(): 35 | setattr(grid.collection_attributes,s,getattr(dataset,s)) 36 | 37 | for name,var in dataset.variables.items(): 38 | perm=[order[x] for x in var.dimensions] 39 | if hasattr(var,"units"): 40 | unit=units_lookup[var.units] 41 | else: 42 | unit=units.none 43 | setattr(grid,name,numpy.array(var).transpose(tuple(perm)) | unit) 44 | 45 | 46 | self.dataset=dataset 47 | 48 | return grid 49 | def close(self): 50 | self.dataset.close() 51 | -------------------------------------------------------------------------------- /src/omuse/units/__init__.py: -------------------------------------------------------------------------------- 1 | from amuse.units import trigo 2 | -------------------------------------------------------------------------------- /src/omuse/units/constants.py: -------------------------------------------------------------------------------- 1 | from amuse.units.constants import * 2 | from amuse.units.trigo import sin,cos 3 | from amuse.units import units 4 | 5 | Rearth=6371.0088 | units.km 6 | 7 | def coriolis_frequency(lat,omega=(1.|units.rev)/(sidereal_day)): 8 | return 2*omega*sin(lat) 9 | def coriolis_beta(lat,omega=(1.|units.rev)/(sidereal_day)): 10 | return 2*omega*cos(lat)/Rearth 11 | -------------------------------------------------------------------------------- /src/omuse/units/quantities.py: -------------------------------------------------------------------------------- 1 | from amuse.units.quantities import * 2 | -------------------------------------------------------------------------------- /src/omuse/units/units.py: -------------------------------------------------------------------------------- 1 | from amuse.units.units import * 2 | from amuse.units.core import named_unit 3 | from amuse.units.quantities import zero 4 | 5 | Rearth = named('Earth radius', 'Rearth', 6371.0088 * km) 6 | Sv=named_unit("Sverdrup","Sv",1.e6*m**3/s) 7 | dyn=named_unit("Dyne","dyn", 1.e-5*N) 8 | bar=named_unit("Bar", "bar", 1.e5*Pa) 9 | dbar=deci(bar) 10 | mbar=milli(bar) 11 | 12 | salt=named("absolute reference salinity","Sr", g/kg) 13 | psu=named("practical salinity unit","psu", (35.16504/35.) * salt) 14 | 15 | nautical_mile=named_unit("Nautical Mile", "nMile", 1852.*m) 16 | knot=named_unit("Knot","knot",nautical_mile/hour) 17 | 18 | Celsius=named_unit("Celsius","celsius", K) 19 | 20 | shu=named("specific humidity unit","shu", kg/kg) 21 | ahu=named("absolute humidity unit","ahu", kg/m**3) 22 | rhu=named("relative humidity unit","rhu", percent) 23 | 24 | mfu=named("mass fraction unit","mfu", kg/kg) 25 | ccu=named("cloud coverage unit","ccu", m**2/m**2) 26 | 27 | ppb=named("parts per billion", "ppb", 1.e-9 * none) 28 | 29 | vsmc=named("volumetric soil moisture content", "vsmc", m**3/m**3) 30 | -------------------------------------------------------------------------------- /support/__init__.py: -------------------------------------------------------------------------------- 1 | supportrc=dict(framework_install=True, package_name="amuse", allow_build_failures='some') 2 | 3 | def use(arg): 4 | if arg == "package": 5 | supportrc["framework_install"]=True 6 | else: 7 | if arg not in ["system","installed","environment"]: 8 | warnings.warn(" assuming framework already installed") 9 | supportrc["framework_install"]=False 10 | 11 | def set_package_name(arg): 12 | supportrc["package_name"]=arg 13 | 14 | def set_allow_build_failures(arg): 15 | if arg=="yes" or (arg==True): arg='some' 16 | if arg=="no" or (arg==False): arg='none' 17 | supportrc["allow_build_failures"]=arg 18 | -------------------------------------------------------------------------------- /support/classifiers.py: -------------------------------------------------------------------------------- 1 | classifiers = [ 2 | 'Development Status :: 4 - Beta', 3 | 'Environment :: Console', 4 | 'Intended Audience :: End Users/Desktop', 5 | 'Intended Audience :: Developers', 6 | 'Intended Audience :: Science/Research', 7 | 'License :: OSI Approved :: Apache Software License', 8 | 'Operating System :: MacOS :: MacOS X', 9 | 'Operating System :: POSIX', 10 | 'Programming Language :: Python :: 3', 11 | 'Programming Language :: Python :: 3.6', 12 | 'Programming Language :: Python :: 3.7', 13 | 'Programming Language :: C', 14 | 'Programming Language :: C++', 15 | 'Programming Language :: Fortran', 16 | 'Topic :: Scientific/Engineering', 17 | ] 18 | 19 | def main(): 20 | for i in classifiers: 21 | print(i) 22 | 23 | if __name__ == "__main__": 24 | main() 25 | -------------------------------------------------------------------------------- /test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omuse-geoscience/omuse/157f9d662aa6044e18f0cf5b939962e9b5d4fa3c/test/__init__.py --------------------------------------------------------------------------------