Exemplo n.º 1
0
def create_random_initial_conditions(N):
    """
    Create an ensemble of `N` randomly chosen vortices and vortex strengths.

    """
    phi = np.random.rand(N, 2) + 1j*np.random.rand(N, 2)
    gamma = np.random.rand(N)
    
    # Normalize
    norms = np.sum(phi.conj()*phi, axis=1)**.5
    phi = row_product(1./norms, phi)

    return phi, gamma
Exemplo n.º 2
0
    def setUp(self):
        # Random initial conditions
        self.gamma = np.random.rand(self.N)        
        
        phi = np.random.rand(self.N, 2) + 1j*np.random.rand(self.N, 2)

        # Normalize phi
        norms = np.sum(phi.conj()*phi, axis=1)**.5
        phi = row_product(1./norms, phi)

        # Perturb away from the unit sphere somewhat
        phi *= 1.01

        self.phi = phi

        # Compute projected point
        self.x = hopf(phi)