Ejemplo n.º 1
0
# 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.
#-------------------------------------------------------------------------------
def xymagnitude(vec):
    return sqrt((vec.x)**2 + (vec.y)**2)


class SelectVISARNodes:
    def __init__(self, z0, dz, dr, label):
        self.z0 = z0
        self.dz = dz
        self.dr = dr
        self.label = label
Ejemplo n.º 2
0
VISARaSampler = AverageCylindricalRadialVelocity(xVISARa, dxVISAR)
VISARbSampler = AverageCylindricalRadialVelocity(xVISARb, dxVISAR)
VISARcSampler = AverageCylindricalRadialVelocity(xVISARc, dxVISAR)

VISARa = NodeHistory(nodesSteel, nodesA, VISARaSampler.sample,
                     baseDir + "/VISAR-a")
VISARb = NodeHistory(nodesSteel, nodesB, VISARbSampler.sample,
                     baseDir + "/VISAR-b")
VISARc = NodeHistory(nodesSteel, nodesC, VISARcSampler.sample,
                     baseDir + "/VISAR-c")
VISARa.nodeFlags.name = "VISAR a points"
VISARb.nodeFlags.name = "VISAR b points"
VISARc.nodeFlags.name = "VISAR c points"

control.appendPeriodicWork(VISARa.sample, VISARsampleFrequency)
control.appendPeriodicWork(VISARb.sample, VISARsampleFrequency)
control.appendPeriodicWork(VISARc.sample, VISARsampleFrequency)


#-------------------------------------------------------------------------------
# Helper method for dumping viz files.
#-------------------------------------------------------------------------------
def viz(fields=[], filename="ExpandingTube-2d"):
    tdamage = nodesSteel.damage()
    etdamage = nodesSteel.effectiveDamage()
    tstrain = damageModel.strain()
    etstrain = damageModel.effectiveStrain()
    sdamage = ScalarField("damage magnitude", nodesSteel)
    mindamage = ScalarField("damage magnitude min", nodesSteel)
    maxdamage = ScalarField("damage magnitude max", nodesSteel)