Skip to content
Snippets Groups Projects

Resolve "Fix default parameters for the periodic bubble example"

2 files
+ 17
4
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -34,7 +34,7 @@ def init_salinity(data, coords, l0):
def compute(args):
from hysop import Field, Box, Simulation, Problem, MPIParams, IOParams
from hysop import Field, Box, Simulation, Problem, MPIParams, IOParams, vprint
from hysop.defaults import VelocityField, VorticityField, \
DensityField, ViscosityField, \
LevelSetField, \
@@ -58,6 +58,7 @@ def compute(args):
from hysop.symbolic.relational import Assignment, LogicalGT, LogicalLT
from hysop.symbolic.misc import Select
from hysop.symbolic.tmp import TmpScalar
from hysop.tools.string_utils import framed_str
# Constants
l0 = 1.5 #initial thickness of the profile
@@ -209,7 +210,17 @@ def compute(args):
S: npts})
### Adaptive timestep operator
adapt_dt = AdaptiveTimeStep(dt, equivalent_CFL=True, max_dt=1e-3,
dx = np.min(np.divide(box.length, np.asarray(args.npts)-1))
S_dt = 0.5*(dx**2)/nu_S
C_dt = 0.5*(dx**2)/nu_C
W_dt = 0.5*(dx**2)/1.0
msg = 'S_dt={}, C_dt={}, W_dt={}'
msg = msg.format(S_dt, C_dt, W_dt)
msg = '\n'+framed_str(' DIFFUSION STABILITY CRITERIA ', msg)
vprint(msg)
max_dt = min(S_dt, C_dt, W_dt)
adapt_dt = AdaptiveTimeStep(dt, equivalent_CFL=True, max_dt=max_dt,
name='merge_dt', pretty_name='dt', )
dt_cfl = adapt_dt.push_cfl_criteria(cfl=args.cfl, Finf=min_max_U.Finf,
equivalent_CFL=True,
@@ -264,7 +275,7 @@ def compute(args):
problem.initialize_field(field=S, formula=init_salinity, l0=l0)
# Finally solve the problem
problem.solve(simu)
problem.solve(simu, dry_run=args.dry_run)
# Finalize
problem.finalize()
@@ -300,7 +311,7 @@ if __name__=='__main__':
parser = ParticleAboveSaltArgParser()
parser.set_defaults(impl='cl', ndim=2, npts=(257,),
parser.set_defaults(impl='cl', ndim=2, npts=(65,),
box_origin=(0.0,), box_length=(1.0,),
tstart=0.0, tend=0.51,
dt=1e-6, cfl=0.5, lcfl=0.125,
Loading