Exemple #1
0
def test_minModelStep_stepExactFalse():
    pList = [load_p('ladr_2d_p', modulepath)]
    nList = [load_n('ladr_2d_n', modulepath)]
    so = So()
    so.name = pList[0].name = "ladr"
    so.tnList = nList[0].tnList
    so.systemStepControllerType = SplitOperator.Sequential_MinModelStep
    so.systemStepExact = False
    so.sList = [default_s]
    opts.logLevel = 7
    opts.verbose = True
    opts.profile = True
    opts.gatherArchive = True
    nList[0].runCFL = 0.33
    nList[0].linearSolver = default_n.LU
    nList[0].multilevelLinearSolver = default_n.LU
    ns = NumericalSolution.NS_base(so, pList, nList, so.sList, opts)
    ns.calculateSolution('ladr_minModelStep_stepExactFalse')
    assert ns.tCount + 1 == len(
        so.tnList), "wrong number of archvie steps " + repr(ns.tCount)
    assert ns.modelList[0].solver.solverList[
        0].solveCalls == 34, "wrong number of steps " + repr(
            ns.modelList[0].solver.solverList[0].solveCalls)
    archiveTimes = []
    for t in ns.ar[0].treeGlobal.iter('Time'):
        archiveTimes.append(t.attrib['Value'])
    archiveTimesCorrect = [
        '0.0', '0.029516097303', '0.0516531702802', '0.0811692675832',
        '0.10330634056', '0.125443413538', '0.154959510841', '0.177096583818',
        '0.206612681121', '0.228749754098', '0.250886827075'
    ]
    npt.assert_almost_equal(np.array(archiveTimes, 'd'),
                            np.array(archiveTimesCorrect, 'd'))
    del ns
Exemple #2
0
def test_minModelStep_stepExactFalse():
    pList = [load_p('ladr_2d_p', modulepath)]
    nList = [load_n('ladr_2d_n', modulepath)]
    so = So()
    so.name = pList[0].name = "ladr"
    so.tnList = nList[0].tnList
    so.systemStepControllerType = SplitOperator.Sequential_MinModelStep
    so.systemStepExact=False
    so.sList=[default_s]
    opts.logLevel=7
    opts.verbose=True
    opts.profile=True
    opts.gatherArchive=True
    nList[0].runCFL=0.33
    nList[0].linearSolver=default_n.LU
    nList[0].multilevelLinearSolver=default_n.LU
    ns = NumericalSolution.NS_base(so,pList,nList,so.sList,opts)
    ns.calculateSolution('ladr_minModelStep_stepExactFalse')
    assert ns.tCount + 1 == len(so.tnList), "wrong number of archvie steps " +`ns.tCount`
    assert ns.modelList[0].solver.solverList[0].solveCalls == 34, "wrong number of steps "+`ns.modelList[0].solver.solverList[0].solveCalls`
    archiveTimes=[]
    for t in ns.ar[0].treeGlobal.iter('Time'):
        archiveTimes.append(t.attrib['Value'])
    archiveTimesCorrect = ['0.0', '0.029516097303', '0.0516531702802', '0.0811692675832', '0.10330634056', '0.125443413538', '0.154959510841', '0.177096583818', '0.206612681121', '0.228749754098', '0.250886827075']
    npt.assert_almost_equal(np.array(archiveTimes,'d'), np.array(archiveTimesCorrect,'d'))
    del ns
Exemple #3
0
def test_minModelStep_stepExactTrue():
    pList = [load_p('ladr_2d_p', modulepath)]
    nList = [load_n('ladr_2d_n', modulepath)]
    so = So()
    so.name = pList[0].name = "ladr"
    so.tnList = nList[0].tnList
    so.systemStepControllerType = SplitOperator.Sequential_MinModelStep
    so.systemStepExact = True
    so.sList = [default_s]
    opts.logLevel = 7
    opts.verbose = True
    opts.profile = True
    opts.gatherArchive = True
    nList[0].runCFL = 0.33
    nList[0].linearSolver = default_n.LU
    nList[0].multilevelLinearSolver = default_n.LU
    ns = NumericalSolution.NS_base(so, pList, nList, so.sList, opts)
    ns.calculateSolution('ladr_minModelStep_stepExactTrue')
    assert ns.tCount + 1 == len(
        so.tnList), "wrong number of archvie steps " + repr(ns.tCount)
    assert ns.modelList[0].solver.solverList[
        0].solveCalls == 40, "wrong number of steps " + repr(
            ns.modelList[0].solver.solverList[0].solveCalls)
    archiveTimes = []
    for t in ns.ar[0].treeGlobal.iter('Time'):
        archiveTimes.append(t.attrib['Value'])
    archiveTimesCorrect = so.tnList
    npt.assert_almost_equal(np.array(archiveTimes, 'd'),
                            np.array(archiveTimesCorrect, 'd'))
    del ns
Exemple #4
0
def test_minModelStep_stepExactTrue():
    pList = [load_p('ladr_2d_p', modulepath)]
    nList = [load_n('ladr_2d_n', modulepath)]
    so = So()
    so.name = pList[0].name = "ladr"
    so.tnList = nList[0].tnList
    so.systemStepControllerType = SplitOperator.Sequential_MinModelStep
    so.systemStepExact=True
    so.sList=[default_s]
    opts.logLevel=7
    opts.verbose=True
    opts.profile=True
    opts.gatherArchive=True
    nList[0].runCFL=0.33
    nList[0].linearSolver=default_n.LU
    nList[0].multilevelLinearSolver=default_n.LU
    ns = NumericalSolution.NS_base(so,pList,nList,so.sList,opts)
    ns.calculateSolution('ladr_minModelStep_stepExactTrue')
    assert ns.tCount + 1 == len(so.tnList), "wrong number of archvie steps "+`ns.tCount`
    assert ns.modelList[0].solver.solverList[0].solveCalls == 40, "wrong number of steps "+`ns.modelList[0].solver.solverList[0].solveCalls`
    archiveTimes=[]
    for t in ns.ar[0].treeGlobal.iter('Time'):
        archiveTimes.append(t.attrib['Value'])
    archiveTimesCorrect = so.tnList
    npt.assert_almost_equal(np.array(archiveTimes,'d'), np.array(archiveTimesCorrect,'d'))
    del ns