distributionType="lattice", xmin=(x0, x0, x0), xmax=(x1, x1, x2), nNodePerh=nPerh, SPH=True) gen2 = GenerateNodeDistribution3d(nx2, nx2, nx2, rho2, distributionType="lattice", xmin=(x1, x0, x0), xmax=(x2, x1, x2), nNodePerh=nPerh, SPH=True) gen = CompositeNodeDistribution(gen1, gen2) distributeNodes3d((nodes1, gen)) else: raise ValueError, "Only tests cases for 1d,2d and 3d." output("nodes1.numNodes") #------------------------------------------------------------------------------- # Optionally randomly jitter the node positions. #------------------------------------------------------------------------------- dx1 = (x1 - x0) / nx1 dx2 = (x2 - x1) / nx2 for i in xrange(nodes1.numInternalNodes): if i < nx1: dx = dx1 else:
elif testDim == "3d": from DistributeNodes import distributeNodes3d from GenerateNodeDistribution3d import GenerateNodeDistribution3d gen1 = GenerateNodeDistribution3d(nx1, nx1 + nx2, nx1 + nx2, rho1, distributionType = "lattice", xmin = (x0, x0, x0), xmax = (x1, x2, x2), nNodePerh = nPerh, SPH = True) gen2 = GenerateNodeDistribution3d(nx2, nx1 + nx2, nx1 + nx2, rho2, distributionType = "lattice", xmin = (x1, x0, x0), xmax = (x2, x2, x2), nNodePerh = nPerh, SPH = True) distributeNodes3d((nodes1, gen1), (nodes2, gen2)) else: raise ValueError, "Only tests cases for 1d,2d and 3d." for nodes in nodeSet: output("nodes.name, nodes.numNodes") # Set node properties. for nodes, eps0 in ((nodes1, eps1), (nodes2, eps2)): eps = nodes.specificThermalEnergy() for i in xrange(nodes.numInternalNodes): eps[i] = eps0 #-------------------------------------------------------------------------------