예제 #1
0
def getPfem():
    global w
    if w:
        return w
    w = pfem

    mshFile = runPath + os.sep + 'impactaxi.msh'

    rho0 = 1000.
    mu = 0.001
    U0 = 100

    pbl = w.Problem()
    pbl.rho0 = rho0
    pbl.mu = mu
    pbl.nonLinAlgorithm = 1
    pbl.solScheme = 1
    pbl.alpha = 1.2
    pbl.beta = 0.
    pbl.gravity = 0.
    pbl.scalingU = U0
    pbl.isAxisymmetric = True

    msh = w.MshData(pbl)
    msh.load(mshFile)
    print(msh)

    toll = 1e-6
    nItMax = 10

    solScheme = w.SchemeMonolithicPSPG(msh, pbl)
    convCriterion = w.ForceBalanceCriterion(msh, pbl, toll, 9.81 * rho0)
    nonLinAlgo = w.PicardAlgorithm(solScheme, convCriterion, nItMax)

    scheme = w.TimeIntegration(msh, pbl, solScheme)

    bndno = 13  # fsi boundary no

    w.Medium(msh, 13, 0., 0., 3)
    w.Medium(msh, 17, mu, rho0, 1)

    # boundaries
    w.Boundary(msh, 15, 7, 0.0)
    w.Boundary(msh, 16, 3, 0.0)
    w.Boundary(msh, 13, 1, 0.0)
    w.Boundary(msh, 13, 2, 0.0)

    # --- Necessary for the correct elimination of nodes along the axis of symmetry ---
    n4 = msh.getNode(4)
    n4.isOnAxisOfSymmetry = True
    # ---

    # Initial velocity
    bird = w.Group(msh, 17)
    loadingset = w.LoadingSet(msh)
    loadingset.add(1, w.InitialVelocity(msh, bird, 0., -U0, 0.))

    scheme.savefreq = 10
    scheme.nthreads = 3
    scheme.gamma = 0.5
    scheme.omega = 0.5
    scheme.addRemoveNodesOption = True
    scheme.tollNLalgo = 1e-7

    # Results
    extManager = w.ExtractorsManager(msh)
    extManager.add(1, w.PositionExtractor(msh, 4))
    extManager.add(6, wt.KineticEnergyExtractor(msh, pbl, 17))
    extManager.add(7, wt.ViscousEnergyExtractor(msh, pbl, scheme, 17))
    extManager.add(8, wt.PressureWorkExtractor(msh, pbl, scheme, 17))
    extManager.add(9, w.MassExtractor(msh, pbl, 17))

    import pfem.tools.link2vtk as v
    gui = v.Link2VTK(msh, scheme, False, True)

    return Module(w, msh, pbl, solScheme, nonLinAlgo, convCriterion, bird,
                  loadingset, scheme, extManager, gui, bndno)
예제 #2
0
def getPfem():
    global w
    if w:
        return w
    w = pfem

    mshFile = runPath+os.sep+'impact.msh'

    print 'mshFile: ', mshFile

    rho0 = 1000.
    mu = 0.001
    U0 = 100

    pbl = w.Problem()
    pbl.rho0 = rho0
    pbl.mu = mu
    pbl.nonLinAlgorithm = 1
    pbl.solScheme = 1
    pbl.alpha = 1.2
    pbl.beta = 0.
    pbl.gravity = 0.
    pbl.scalingU = U0

    msh = w.MshData(pbl)
    msh.load(mshFile)
    print msh

    toll = 1e-6
    nItMax = 10

    solScheme = w.SchemeMonolithicPSPG(msh, pbl)
    convCriterion = w.ForcesBalanceNormedBodyForceCriterion(msh, pbl, toll)
    nonLinAlgo = w.PicardAlgorithm(solScheme, convCriterion, nItMax)

    scheme = w.TimeIntegration(msh, pbl, solScheme)

    bndno = 13 # fsi boundary

    w.Medium(msh, 13, 0., 0., 3)
    w.Medium(msh, 16, mu, rho0, 1)

    # boundaries
    w.Boundary(msh, 15, 3, 0.0)
    w.Boundary(msh, 13, 1, 0.0)
    w.Boundary(msh, 13, 2, 0.0)

    # Initial velocity
    bird = w.Group(msh, 16)
    loadingset = w.LoadingSet(msh)
    loadingset.add(1, w.InitialVelocity(msh, bird, 0., -U0, 0.))

    scheme.savefreq = 10
    scheme.gamma = 0.5
    scheme.omega = 0.5
    scheme.addRemoveNodesOption = True
    scheme.tollNLalgo = 1e-7

    # Results
    extManager = w.ExtractorsManager(msh)
    extManager.add(1, w.PositionExtractor(msh, 310))
    extManager.add(6, wt.KineticEnergyExtractor(msh, pbl, 16))
    extManager.add(7, wt.ViscousEnergyExtractor(msh, pbl, scheme, 16))
    extManager.add(8, wt.PressureWorkExtractor(msh, pbl, scheme, 16))
    extManager.add(9, w.MassExtractor(msh, pbl, 16))

    import pfem.tools.link2vtk as v
    gui = v.Link2VTK(msh, scheme, False, True)

    return Module(w, msh, pbl, solScheme, nonLinAlgo, convCriterion, bird, loadingset, scheme, extManager, gui, bndno)