output('integrator')
output('integrator.havePhysicsPackage(hydro)')
output('integrator.havePhysicsPackage(strength)')
output('integrator.havePhysicsPackage(damageModel)')
output('integrator.valid()')
output('integrator.lastDt')
output('integrator.dtMin')
output('integrator.dtMax')
output('integrator.dtGrowth')

#-------------------------------------------------------------------------------
# Build the controller.
#-------------------------------------------------------------------------------
control = SpheralController(integrator, WT,
                            boundaryConditions = [xbc],
                            statsStep = statsStep,
                            restartStep = restartStep,
                            restartBaseName = restartBaseName,
                            initializeMassDensity = False)
output('control')

#-------------------------------------------------------------------------------
# Smooth the initial conditions/restore state.
#-------------------------------------------------------------------------------
if restoreCycle is not None:
    control.loadRestartFile(restoreCycle)
else:
    control.smoothState(smoothIters)

    # Viz the initial conditions.
    vx = ScalarField2d("x velocity", nodes)
    vy = ScalarField2d("y velocity", nodes)
Ejemplo n.º 2
0
    bcs = [xbc, ybc, zbc]
elif phiFactor == 1.0:
    bcs = [ybc, zbc]
else:
    bcs = [zbc]
for package in integrator.physicsPackages():
    for bc in bcs:
        package.appendBoundary(bc)

#-------------------------------------------------------------------------------
# Build the controller.
#-------------------------------------------------------------------------------
control = SpheralController(integrator,
                            WT,
                            statsStep=statsStep,
                            restartStep=restartStep,
                            redistributeStep=redistributeStep,
                            restartBaseName=restartBaseName,
                            initializeMassDensity=False)
output("control")

#-------------------------------------------------------------------------------
# Monitor the evolution of the mass averaged strain.
#-------------------------------------------------------------------------------
strainHistory = AverageStrain(damageModel, dataDir + "/strainhistory.txt")
control.appendPeriodicWork(strainHistory.sample, strainFrequency)


#-------------------------------------------------------------------------------
# Select the nodes for the VISAR sampling.
#-------------------------------------------------------------------------------
Ejemplo n.º 3
0
integrator.dtGrowth = dtGrowth
output('integrator')
output('integrator.havePhysicsPackage(hydro)')
output('integrator.havePhysicsPackage(strength)')
output('integrator.valid()')
output('integrator.lastDt')
output('integrator.dtMin')
output('integrator.dtMax')
output('integrator.dtGrowth')

#-------------------------------------------------------------------------------
# Build the controller.
#-------------------------------------------------------------------------------
control = SpheralController(integrator, WT,
                            statsStep = statsStep,
                            restartStep = restartStep,
                            restartBaseName = restartBaseName,
                            initializeMassDensity = False)
output('control')

#-------------------------------------------------------------------------------
# Plot the result with strength.
#-------------------------------------------------------------------------------
dataDir = "dumps-RotatingSteelRod-2d-%ix%i-nph=%4.2f" % (nx, ny, nPerh)
restartDir = dataDir + "/restarts"
restartBaseName = restartDir + "/RotatingSteelRod-%ix%i" % (nx, ny)
restoreCycle = findLastRestart(restartBaseName)
control.setRestartBaseName(restartBaseName)
control.loadRestartFile(restoreCycle)

Lz0 = [x.z for x in control.conserve.amomHistory]
output('integrator.havePhysicsPackage(hydro)')
output('integrator.havePhysicsPackage(strength)')
output('integrator.havePhysicsPackage(damageModel)')
output('integrator.valid()')
output('integrator.lastDt')
output('integrator.dtMin')
output('integrator.dtMax')
output('integrator.dtGrowth')

#-------------------------------------------------------------------------------
# Build the controller.
#-------------------------------------------------------------------------------
control = SpheralController(integrator,
                            WT,
                            boundaryConditions=[xbc],
                            statsStep=statsStep,
                            restartStep=restartStep,
                            restartBaseName=restartBaseName,
                            initializeMassDensity=False)
output('control')

#-------------------------------------------------------------------------------
# Smooth the initial conditions/restore state.
#-------------------------------------------------------------------------------
if restoreCycle is not None:
    control.loadRestartFile(restoreCycle)
else:
    control.smoothState(smoothIters)

#-------------------------------------------------------------------------------
# Advance to the end time.
Ejemplo n.º 5
0
# Construct a synchronous RK2 integrator, and add the one physics package and
# boundary condtion.
integrator = CheapSynchronousRK2Integrator1d(db)
integrator.appendPhysicsPackage(hydro)
integrator.HsmoothMin = HsmoothMin
integrator.HsmoothMax = HsmoothMax
integrator.lastDt = dt
integrator.kernel = WT
if dtMin:
    integrator.dtMin = dtMin
if dtMax:
    integrator.dtMax = dtMax
integrator.sumForMassDensity = sumForMassDensity

control = SpheralController(integrator, WT,
                            boundaryConditions = [xbc0],
                            statsStep = statsStep)

##################################################################################
# Advance to the end time one step at a time, taking snapshots of the particle
# position as you go.
xInternal = []
xGhost = []
while control.time() < goalTime:
    control.advance(goalTime, 1)
    output("control.time(), nodes.numInternalNodes, nodes.numGhostNodes")
    xInternal.append((control.time(), nodes.positions[0].x))
    if nodes.numGhostNodes > 0:
        xGhost.append((control.time(), nodes.positions[1].x))

# Make Numeric arrays out of the history of our positions.
Ejemplo n.º 6
0
#-------------------------------------------------------------------------------
# Construct boundary conditions, and add them to our physics packages.
#-------------------------------------------------------------------------------
if not twoBalls:
    xbcPlane = Plane3d(Vector3d(0.0, 0.0, 0.0), Vector3d(1.0, 0.0, 0.0))
    xbc = ReflectingBoundary3d(xbcPlane)
    for package in integrator.physicsPackages():
        package.appendBoundary(xbc)

#-------------------------------------------------------------------------------
# Build the controller.
#-------------------------------------------------------------------------------
control = SpheralController(integrator, WT,
                            statsStep = statsStep,
                            restartStep = restartStep,
                            redistributeStep = redistributeStep,
                            restartBaseName = restartBaseName,
                            initializeMassDensity = False)
output("control")

#-------------------------------------------------------------------------------
# Drop visualization files.
#-------------------------------------------------------------------------------
def viz(fields = [],
        filename = "RubberBalls-3d"):
    dumpPhysicsState(integrator,
                     filename,
                     visitDir,
                     fields = fields,
                     )
Ejemplo n.º 7
0
output("integrator.dtMin")
output("integrator.dtMax")
output("integrator.dtGrowth")
output("integrator.rigorousBoundaries")
output("integrator.verbose")

#-------------------------------------------------------------------------------
# Build the controller.
#-------------------------------------------------------------------------------
from SpheralPointmeshSiloDump import dumpPhysicsState
control = SpheralController(integrator, WT,
                            volumeType = volumeType,
                            statsStep = statsStep,
                            restartStep = restartStep,
                            redistributeStep = redistributeStep,
                            restartBaseName = restartBaseName,
                            restoreCycle = restoreCycle,
                            vizMethod = dumpPhysicsState,
                            vizBaseName = "TaylorImpact",
                            vizDir = vizDir,
                            vizStep = vizCycle,
                            vizTime = vizTime)
output("control")

#-------------------------------------------------------------------------------
# In the two material case, it's useful to smooth the initial velocity field
# in order to avoid interpenetration at the interface.
#-------------------------------------------------------------------------------
if (not reflect) and control.totalSteps == 0:
    print "Smoothing initial velocity field."
    state = State(db, integrator.physicsPackages())
    derivs = StateDerivatives(db, integrator.physicsPackages())