Skip to content

Instantly share code, notes, and snippets.

@ashwinvis
Created July 20, 2018 20:16
Show Gist options
  • Save ashwinvis/854db533578b28b041e9890def53ed0a to your computer and use it in GitHub Desktop.
Save ashwinvis/854db533578b28b041e9890def53ed0a to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import matplotlib.pyplot as plt\n",
"from fluidsim import load_sim_for_plot"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"%load_ext fluidsim.magic"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Add parameter attributes: {'NO_SHEAR_MODES'}\n",
"Add parameter attributes: {'deltat_max', 'cfl_coef'}\n",
"Add parameter attributes: {'modif_after_init'}\n",
"Add parameter attributes: {'enable'}\n",
"Add parameter children: {'tcrandom', 'normalized'}\n",
"Add parameter attributes: {'which_root', 'type'}\n",
"Add parameter attributes: {'only_positive'}\n",
"Add parameter attributes: {'time_correlation'}\n",
"ImportError: fluidfft.fft2d.with_cufft\n",
"params.oper.type_fft FFTWCCY -> fft2d.with_fftw1d\n",
"*************************************\n",
"Program fluidsim\n",
"To plot the forcing modes, you can use:\n",
"sim.forcing.forcing_maker.plot_forcing_region()\n",
"sim: <class 'fluidsim.solvers.sw1l.exactlin.modified.solver.Simul'>\n",
"sim.oper: <class 'fluidsim.solvers.sw1l.operators.OperatorsPseudoSpectralSW1L'>\n",
"sim.output: <class 'fluidsim.solvers.sw1l.exactlin.modified.output.OutputSW1LExactlinModified'>\n",
"sim.state: <class 'fluidsim.solvers.sw1l.exactlin.state.StateSW1LExactLin'>\n",
"sim.time_stepping: <class 'fluidsim.base.time_stepping.pseudo_spect_cy.TimeSteppingPseudoSpectral'>\n",
"sim.init_fields: <class 'fluidsim.solvers.sw1l.init_fields.InitFieldsSW1L'>\n",
"sim.forcing: <class 'fluidsim.solvers.sw1l.forcing.ForcingSW1L'>\n",
"\n",
"solver SW1Lexmod, RK4 and sequential,\n",
"type fft: fluidfft.fft2d.with_fftw1d\n",
"nx = 192 ; ny = 192\n",
"lx = 50 ; ly = 50\n",
"path_run =\n",
"/scratch/avmo/data/toy_model_waves_vortices/SW1Lexmod_noise_c=20_Bu=1.0_beta=0.0_L=50.x50._192x192_2017-09-05_07-48-09\n",
"init_fields.type: constant\n",
"\n",
"Initialization outputs:\n",
"sim.output.increments: <class 'fluidsim.base.output.increments.IncrementsSW1L'>\n",
"sim.output.phys_fields: <class 'fluidsim.base.output.phys_fields2d.PhysFieldsBase2D'>\n",
"sim.output.pdf: <class 'fluidsim.base.output.prob_dens_func.ProbaDensityFunc'>\n",
"sim.output.spatial_means: <class 'fluidsim.solvers.sw1l.output.spatial_means.SpatialMeansMSW1L'>\n",
"sim.output.spectra: <class 'fluidsim.solvers.sw1l.output.spectra.SpectraSW1LNormalMode'>\n",
"sim.output.spect_energy_budg: <class 'fluidsim.solvers.sw1l.output.spect_energy_budget.SpectralEnergyBudgetSW1LModified'>\n",
"sim.output.time_signals_fft: <class 'fluidsim.base.output.time_signals_fft.TimeSignalsK'>\n",
"\n",
"Memory usage at the end of init. (equiv. seq.): 123.8125 Mo\n",
"Size of state_spect (equiv. seq.): 0.893952 Mo\n",
"c2 = 400 ; f = 15.08 ; kd2 = 0.56849\n"
]
}
],
"source": [
"%fluidsim_load -m"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"dt_equations = 5.0005\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "fd50aa6e243042c0a12181e465e8e8ef",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"FigureCanvasNbAgg()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%matplotlib widget\n",
"sim.output.phys_fields.animate('rot')"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"FigureCanvasNbAgg()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "dd5a04b8879e455ba72e2b810e4d3a66",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='time', max=20.0, step=10.0), Output()), _dom_classes…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"sim.output.phys_fields.interact('rot', dt_equations=10.)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from fluidsim.base.output.phys_fields import SetOfPhysFieldFiles\n",
"\n",
"phys = SetOfPhysFieldFiles()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['./state_phys_t=000.000.hd5',\n",
" './state_phys_t=005.000.hd5',\n",
" './state_phys_t=010.001.hd5']"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"phys.path_files"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment