Skip to content

Commit

Permalink
updating dynamic timestepping
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrunnels committed Nov 8, 2024
1 parent f5f1f55 commit 8e70e34
Show file tree
Hide file tree
Showing 8 changed files with 224 additions and 59 deletions.
2 changes: 1 addition & 1 deletion input.ChannelFlow_eps0.05
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ dynamictimestep.on = 1
dynamictimestep.verbose = 1
dynamictimestep.cfl = 0.001
dynamictimestep.max = 1.0
dynamictimestep.min = 0.0
dynamictimestep.min = 1E-8
149 changes: 149 additions & 0 deletions input.MovingSphere
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
alamo.program = hydro

### OUTPUT ###

plot_file = ./output

### MESHING ###

amr.plot_dt = 1.0
#amr.plot_int = 1000
amr.max_grid_size = 500000
amr.blocking_factor = 8
amr.regrid_int = 100
amr.grid_eff = 0.8


amr.max_level = 3
timestep = 0.0001
#amr.n_cell = 256 128
amr.n_cell = 64 32
#amr.n_cell = 128 32

# Uncomment to test AMR
#amr.max_level = 2
#amr.n_cell = 128 32 0

### DIMENSIONS ###

geometry.prob_lo = -12.0 -12.0 0.0 # [ m ]
geometry.prob_hi = 36.0 12.0 0.0 # [ m ]

geometry.is_periodic = 0 0 0

### TIME STEP ###

stop_time = 10000.0

### ETA IC ###

rho_injected.ic.type = expression
rho_injected.ic.expression.region0 = "100.0"

mdot.ic.type = expression
mdot.ic.expression.region0 = "10"
mdot.ic.expression.region1 = "0.0"

q.ic.type = expression
q.ic.expression.region0 = "0.0"
q.ic.expression.region1 = "0.0"

eta.ic.type = expression
eta.ic.expression.constant.eps = 0.4
eta.ic.expression.constant.vel_x = 0.0
eta.ic.expression.constant.vel_y = 0.0
eta.ic.expression.constant.x0 = 0.0
eta.ic.expression.constant.R = 1.5
#eta.ic.expression.region0 = "0.5*(1 + tanh((sqrt((x-x0-0.1*t)**2 + (y)**2) - 3.0)/eps))"
eta.ic.expression.region0 = "1.0 - 0.5*(1 + tanh((1.0-abs(x-0.1*t))/eps)) * 0.5*(1 + tanh((5.0-abs(y))/eps))"

### HYDRO PARAM ###

gamma = 1.4
mu = 10
#pref = 1000.0
pref = 1000.0

density.ic.type = expression
density.ic.expression.region0 = "100.0"

velocity.ic.type = expression
velocity.ic.expression.region0 = "0.0"
velocity.ic.expression.region1 = "0.0"

pressure.ic.type = expression
pressure.ic.expression.region0 = "0.0"

### SOLID ###

solid.density.ic.type = expression
solid.density.ic.expression.region0 = "100.0"

solid.momentum.ic.type = expression
solid.momentum.ic.expression.region0 = "0.0"
solid.momentum.ic.expression.region1 = "0.0"

solid.energy.ic.type = expression
solid.energy.ic.expression.region0 = "0.0"

### ETA BC ###

pf.eta.bc.type.xlo = neumann
pf.eta.bc.type.xhi = neumann
pf.eta.bc.type.ylo = neumann
pf.eta.bc.type.yhi = neumann
pf.eta.bc.type.zlo = neumann
pf.eta.bc.type.zhi = neumann

pf.eta.bc.val.xlo = 0.0
pf.eta.bc.val.xhi = 0.0
pf.eta.bc.val.ylo = 0.0
pf.eta.bc.val.yhi = 0.0
pf.eta.bc.val.zlo = 0.0
pf.eta.bc.val.zhi = 0.0

### HYDRO BC ###

density.bc.type.xhi = neumann
density.bc.type.xlo = neumann
density.bc.type.ylo = neumann
density.bc.type.yhi = neumann
density.bc.val.xhi = 0.0
density.bc.val.xlo = 0.0
density.bc.val.ylo = 0.0
density.bc.val.yhi = 0.0

energy.bc.type.xhi = neumann
energy.bc.type.xlo = neumann
energy.bc.type.ylo = neumann
energy.bc.type.yhi = neumann
energy.bc.val.xhi = 0.0
energy.bc.val.xlo = 0.0
energy.bc.val.ylo = 0.0
energy.bc.val.yhi = 0.0

momentum.bc.type.xlo = dirichlet neumann
momentum.bc.type.xhi = neumann neumann
momentum.bc.type.ylo = neumann dirichlet
momentum.bc.type.yhi = neumann dirichlet
momentum.bc.val.xlo = 0.0 0.0
momentum.bc.val.xhi = 0.0 0.0
momentum.bc.val.ylo = 0.0 0.0
momentum.bc.val.yhi = 0.0 0.0

### HYDRO REFINEMENT CRITERIA ###

eta_refinement_criterion = 0.1
omega_refinement_criterion = 0.01
gradu_refinement_criterion = 0.05

#TODO

#amr.abort_on_nan = 0

dynamictimestep.on = 1
dynamictimestep.verbose = 1
dynamictimestep.max = 0.001
dynamictimestep.min = 1E-4
cfl = 1.0
cfl_v = 1.0
75 changes: 40 additions & 35 deletions input.allencahn
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ amr.max_grid_size = 500000
amr.blocking_factor = 8
amr.regrid_int = 100
amr.grid_eff = 0.8
amr.max_level = 3
amr.max_level = 4
timestep = 1e-2
amr.n_cell = 64 64
geometry.prob_lo = -24.0 -24.0 0.0 # [ m ]
geometry.prob_hi = 24.0 24.0 0.0 # [ m ]
amr.n_cell = 64 16
geometry.prob_lo = -24.0 -6.0 0.0 # [ m ]
geometry.prob_hi = 24.0 6.0 0.0 # [ m ]
geometry.is_periodic = 0 0 0
stop_time = 5000.0

Expand Down Expand Up @@ -42,11 +42,13 @@ allencahn.alpha.bc.val.xlo = 0.0
allencahn.alpha.bc.val.xhi = 0.0
allencahn.alpha.bc.val.ylo = 0.0
allencahn.alpha.bc.val.yhi = 0.0
allencahn.alpha.ic.type = bmp
allencahn.alpha.ic.bmp.filename = tests/AllenCahn/bordernoise.bmp
allencahn.alpha.ic.bmp.fit = fitwidth
allencahn.alpha.ic.bmp.max = 0
allencahn.alpha.ic.bmp.min = 255
allencahn.alpha.ic.type = png
allencahn.alpha.ic.png.filename = tests/AllenCahn/bordernoise.png
allencahn.alpha.ic.png.fit = coord
allencahn.alpha.ic.png.coord.lo = -24 -24
allencahn.alpha.ic.png.coord.hi = 24 24
allencahn.alpha.ic.png.max = 0
allencahn.alpha.ic.png.min = 255

#allencahn.alpha.ic.type = expression
#allencahn.alpha.ic.expression.region0 = "0.5 * (1 + tanh((sqrt(x^2+y^2) - 1.0)/0.1))"
Expand All @@ -56,7 +58,7 @@ allencahn.alpha.ic.bmp.min = 255
#allencahn.alpha.ic.psread.mult = 10.0
#allencahn.alpha.ic.psread.x0 = -20.0 0
#allencahn.alpha.ic.psread.invert = 1
allencahn.ch.L = 10.0
allencahn.ch.L = 50.0
allencahn.ch.eps = 0.1
allencahn.ch.grad = 0.01
allencahn.ch.chempot = 0.01
Expand All @@ -77,8 +79,8 @@ allencahn.ch.chempot = 0.01
#hydro.deltapInterface.ic.expression.region0 = "0.0"
### HYDRO PARAM ###
hydro.gamma = 1.4
hydro.cfl = 0.4
hydro.mu = 0.5
hydro.mu = 10.0
hydro.pref = 10000
#hydro.rho_solid = 30.0 #kg/m^3
#hydro.rho_fluid = 20.0 #kg/m^3
#hydro.E_solid = 5.0
Expand Down Expand Up @@ -114,47 +116,50 @@ hydro.density.bc.val.xhi = 0.0
hydro.density.bc.val.xlo = 0.0
hydro.density.bc.val.ylo = 0.0
hydro.density.bc.val.yhi = 0.0
hydro.pressure.bc.type.xhi = neumann
hydro.pressure.bc.type.xlo = neumann
hydro.pressure.bc.type.ylo = neumann
hydro.pressure.bc.type.yhi = neumann
hydro.pressure.bc.val.xhi = 0.0
hydro.pressure.bc.val.xlo = 0.0
hydro.pressure.bc.val.ylo = 0.0
hydro.pressure.bc.val.yhi = 0.0
hydro.velocity.bc.type.xhi = neumann neumann
hydro.velocity.bc.type.xlo = dirichlet neumann
hydro.velocity.bc.type.ylo = neumann dirichlet
hydro.velocity.bc.type.yhi = neumann dirichlet
hydro.velocity.bc.val.xhi = 0.0 0.0
hydro.velocity.bc.val.xlo = 0.0 0.0
hydro.velocity.bc.val.ylo = 0.0 0.0
hydro.velocity.bc.val.yhi = 0.0 0.0
hydro.energy.bc.type.xhi = neumann
hydro.energy.bc.type.xlo = neumann
hydro.energy.bc.type.ylo = neumann
hydro.energy.bc.type.yhi = neumann
hydro.energy.bc.val.xhi = 0.0
hydro.energy.bc.val.xlo = 0.0
hydro.energy.bc.val.ylo = 0.0
hydro.energy.bc.val.yhi = 0.0
hydro.momentum.bc.type.xhi = neumann neumann
hydro.momentum.bc.type.xlo = dirichlet neumann
hydro.momentum.bc.type.ylo = neumann dirichlet
hydro.momentum.bc.type.yhi = neumann dirichlet
hydro.momentum.bc.val.xhi = 0.0 0.0
hydro.momentum.bc.val.xlo = 100. 0.0
hydro.momentum.bc.val.ylo = 0.0 0.0
hydro.momentum.bc.val.yhi = 0.0 0.0
hydro.eta.ic.constant.value = 1.0
### HYDRO REFINEMENT CRITERIA ###
#hydro.r_refinement_criterion = 0.1
#hydro.e_refinement_criterion = 0.1
#hydro.m_refinement_criterion = 0.1
hydro.eta_refinement_criterion = 0.1
hydro.omega_refinement_criterion = 0.05
hydro.omega_refinement_criterion = 10000000
hydro.gradu_refinement_criterion = 10000000

hydro.solid.momentum.ic.constant.value = 0.0
hydro.solid.density.ic.constant.value = 1.0
hydro.solid.density.ic.constant.value = 20.0
hydro.solid.energy.ic.constant.value = 0.0

hydro.rho_injected.ic.constant.value = 1.0
hydro.mdot.ic.constant.value = 0.0
hydro.q.ic.constant.value = 0.0

hydro.Lfactor=-10
hydro.Pfactor=10
#hydro.Lfactor=-10
#hydro.Pfactor=10



amr.abort_on_nan = 0

dynamictimestep.on = 1
dynamictimestep.verbose = 1
dynamictimestep.max = 0.001
dynamictimestep.min = 0.0
dynamictimestep.cfl = 0.05
dynamictimestep.max = 0.01
dynamictimestep.min = 1E-4
#dynamictimestep.cfl = 0.005
hydro.cfl = 0.1
hydro.cfl_v = 1.0
2 changes: 2 additions & 0 deletions src/Integrator/AllenCahn.H
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "IC/Constant.H"
#include "IC/Expression.H"
#include "IC/BMP.H"
#include "IC/PNG.H"
#include "IC/PSRead.H"
#include "Numeric/Stencil.H"

Expand Down Expand Up @@ -77,6 +78,7 @@ public:
else if (type == "constant") value.ic = new IC::Constant(value.geom, pp, "alpha.ic.constant");
else if (type == "expression") value.ic = new IC::Expression(value.geom, pp, "alpha.ic.expression");
else if (type == "bmp") value.ic = new IC::BMP(value.geom, pp, "alpha.ic.bmp");
else if (type == "png") value.ic = new IC::PNG(value.geom, pp, "alpha.ic.png");
else if (type == "psread") value.ic = new IC::PSRead(value.geom, pp, "alpha.ic.psread");
else Util::Abort(INFO, "Invalid ic.type ", type);

Expand Down
2 changes: 1 addition & 1 deletion src/Integrator/Hydro.H
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private:
Set::Scalar vy_max = 0.0;

Set::Scalar r_refinement_criterion=NAN, e_refinement_criterion=NAN, m_refinement_criterion=NAN, eta_refinement_criterion=NAN, omega_refinement_criterion=NAN, gradu_refinement_criterion=NAN, p_refinement_criterion=NAN, rho_refinement_criterion;
Set::Scalar gamma=NAN, cfl=NAN, mu=NAN, Lfactor=NAN, Pfactor=NAN, pref=NAN;
Set::Scalar gamma=NAN, cfl=NAN, cfl_v=NAN, mu=NAN, Lfactor=NAN, Pfactor=NAN, pref=NAN;
};
}

Expand Down
Loading

0 comments on commit 8e70e34

Please sign in to comment.