def writeVelocityStructure(temp, model):
    """Velocity component."""
    temp.append('void velocity(double x, double y,')
    temp.append('double z, double *velocity) {\n\n')
    temp.append('\tif (sqrt(x*x + y*y + z*z) == 0.0){\n')
    temp.append('\t\tvelocity[0] = 0.0;\n')
    temp.append('\t\tvelocity[1] = 0.0;\n')
    temp.append('\t\tvelocity[2] = 0.0;\n')
    temp.append('\t\t return;\n')
    temp.append('\t}\n\n')
    temp.append('\tdouble velo;\n')
    if model.mstar is not None:
        temp.append('\tvelo = sqrt(6.67e-11 * %.3f' % model.mstar)
        temp.append(' * 1.989e30 / sqrt(x*x + y*y + z*z));\n')
    else:
        temp.append('\tvelo = findvalue(x, y, z, vrot);\n')
    temp.append('\tvelocity[0] = velo * sin(atan2(y,x));\n')
    temp.append('\tvelocity[1] = velo * cos(atan2(y,x));\n')
    temp.append('\tvelocity[2] = 0.0;\n')
    temp.append('\n}\n\n\n')
    return
