-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
120 changed files
with
772 additions
and
475 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
"""Taylor-Green Vortex at Re = 1600 | ||
=================================== | ||
https://www.grc.nasa.gov/hiocfd/wp-content/uploads/sites/22/case_c3.3.pdf | ||
""" | ||
|
||
import numpy as np | ||
|
||
from fluidsim.solvers.ns3d.solver import Simul | ||
|
||
params = Simul.create_default_params() | ||
|
||
Re = 1600 | ||
V0 = 1.0 | ||
L = 1 | ||
params.nu_2 = V0 * L / Re | ||
|
||
params.init_fields.type = "in_script" | ||
|
||
params.time_stepping.t_end = 20.0 * L / V0 | ||
|
||
nx = 128 // 4 | ||
params.oper.nx = params.oper.ny = params.oper.nz = nx | ||
lx = params.oper.Lx = params.oper.Ly = params.oper.Lz = 2 * np.pi * L | ||
|
||
params.output.periods_save.phys_fields = 4 | ||
params.output.periods_save.spatial_means = 0.2 | ||
params.output.periods_save.spectra = 0.5 | ||
|
||
sim = Simul(params) | ||
|
||
X, Y, Z = sim.oper.get_XYZ_loc() | ||
|
||
vx = V0 * np.sin(X / L) * np.cos(Y / L) * np.cos(Z / L) | ||
vy = -V0 * np.cos(X / L) * np.sin(Y / L) * np.cos(Z / L) | ||
vz = sim.oper.create_arrayX(value=0) | ||
|
||
sim.state.init_statephys_from(vx=vx, vy=vy, vz=vz) | ||
|
||
sim.state.statespect_from_statephys() | ||
sim.state.statephys_from_statespect() | ||
|
||
# only useful to plot fields before time_stepping | ||
# sim.output.init_with_initialized_state() | ||
|
||
if __name__ == "__main__": | ||
|
||
sim.time_stepping.start() | ||
|
||
from fluiddyn.util.mpi import printby0 | ||
|
||
printby0( | ||
f""" | ||
To visualize the output with Paraview, create a file states_phys.xmf with: | ||
fluidsim-create-xml-description {sim.output.path_run} | ||
# To visualize with fluidsim: | ||
cd {sim.output.path_run} | ||
ipython | ||
# in ipython: | ||
from fluidsim import load_sim_for_plot | ||
sim = load_sim_for_plot() | ||
sim.output.phys_fields.set_equation_crosssection(f'x={{sim.oper.Lx/4}}') | ||
sim.output.phys_fields.animate('vx') | ||
sim.output.phys_fields.plot(field="vx", time=10) | ||
sim.output.spatial_means.plot() | ||
sim.output.spectra.plot1d(tmin=12, tmax=16, coef_compensate=5/3) | ||
""" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,6 @@ | |
:private-members: | ||
""" | ||
from __future__ import division | ||
|
||
from builtins import object | ||
|
||
import numpy as np | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.