impactorGenerator = PlanetNodeGenerators.EqualSpacingSphericalShells(
            nLayers=nxImp / 2,
            rho=rhoImpactor,
            rMin=0.0,
            rMax=rImpactor,
            nNodePerh=nPerh)
        pass
    else:
        print "unknown generator type"
        sys.exit(1)
        pass

    # Tweak density profile if possible, to start closer to equilibrium.
    targetGenerator.EOS = eosTarget
    impactorGenerator.EOS = eosImpactor
    shelpers.hydrostaticize_one_layer_planet(targetGenerator)
    shelpers.hydrostaticize_one_layer_planet(impactorGenerator)

    # Place the impactor at the point of impact. It is coming from the
    # positive x direction in the xy plane.
    displace = Vector((rTarget + rImpactor) * cos(pi / 180.0 * angleImpact),
                      (rTarget + rImpactor) * sin(pi / 180.0 * angleImpact),
                      0.0)
    for k in range(impactorGenerator.localNumNodes()):
        impactorGenerator.x[k] += displace.x
        impactorGenerator.y[k] += displace.y
        impactorGenerator.z[k] += displace.z
        pass

    # Fill node lists using generators and distribute to ranks.
    print "Starting node distribution..."
コード例 #2
0
nodeSet = [planet]

# Unless restarting, create the generator and set initial field values.
if restoreCycle is None:
    # Create a node generator with choice of geometry and density profile.
    if generator_type == 'hcp':
        planetGenerator = PlanetNodeGenerators.HexagonalClosePacking(
                            nx = nxPlanet,
                            rho = rhoPlanet,
                            scale = 2*rPlanet,
                            rMin = 0.0,
                            rMax = rPlanet,
                            nNodePerh = nPerh)
        if density_profile == 'qic':
            planetGenerator.EOS = eosPlanet
            shelpers.hydrostaticize_one_layer_planet(planetGenerator)
        elif density_profile == 'ple':
            print "Pseudo-Lane-Emden not yet implemented for HCP generator"
            sys.exit(1)
        else:
            print "ERROR: unknown density integration method."
            sys.exit(1)
            pass
        pass
    elif generator_type == 'ico':
        if density_profile == 'ple':
            from HydroStaticProfile import EarthLikeProfileConstantTemp3d
            eostup = (eosPlanet, [0, rPlanet])
            rhoProfile = EarthLikeProfileConstantTemp3d(
                                            rho0 = eosPlanet.referenceDensity,
                                            rMax = rPlanet,
        impactorGenerator = PlanetNodeGenerators.EqualSpacingSphericalShells(
                              nLayers = nxImp/2,
                              rho = rhoImpactor,
                              rMin = 0.0,
                              rMax = rImpactor,
                              nNodePerh = nPerh)
        pass
    else:
        print "unknown generator type"
        sys.exit(1)
        pass

    # Tweak density profile if possible, to start closer to equilibrium.
    targetGenerator.EOS = eosTarget
    impactorGenerator.EOS = eosImpactor
    shelpers.hydrostaticize_one_layer_planet(targetGenerator)
    shelpers.hydrostaticize_one_layer_planet(impactorGenerator)

    # Place the impactor at the point of impact. It is coming from the 
    # positive x direction in the xy plane.
    displace = Vector((rTarget+rImpactor)*cos(pi/180.0*angleImpact),
                      (rTarget+rImpactor)*sin(pi/180.0*angleImpact),
                      0.0)
    for k in range(impactorGenerator.localNumNodes()):
        impactorGenerator.x[k] += displace.x
        impactorGenerator.y[k] += displace.y
        impactorGenerator.z[k] += displace.z
        pass
                                                       
    # Fill node lists using generators and distribute to ranks.
    print "Starting node distribution..."