Пример #1
0
cfgMain['MAIN']['avalancheDir'] = avaDir

# Clean input directory(ies) of old work and output files
initProj.cleanModuleFiles(avaDir, com1DFA, 'com1DFA')

# Start logging
log = logUtils.initiateLogger(avaDir, logName)
log.info('MAIN SCRIPT')
log.info('Current avalanche: %s', avaDir)

# Load configuration
damBreakCfg = os.path.join(avaDir, 'Inputs', 'damBreak_com1DFACfg.ini')
cfg = cfgUtils.getModuleConfig(com1DFA, damBreakCfg)
cfgGen = cfg['GENERAL']

# Load flow depth from analytical solution
hL, hR, uR, phi, xR = damBreak.damBreakSol(avaDir, cfgMain, cfg)
xR = xR * np.cos(phi)  # projected on the horizontal plane
dtAnalysis = cfg['DAMBREAK'].getfloat('dtStep')

# call com1DFAPy to perform simulation - provide configuration file and release thickness function
Particles, Fields, Tsave, dem, plotDict, reportDictList = runCom1DFA.runCom1DFA(
    avaDir=avaDir, cfgFile=damBreakCfg)

# create simDict of results
inputDir = pathlib.Path(avaDir, 'Outputs', 'com1DFA', 'peakFiles', 'timeSteps')
dataComSol = fU.makeSimDict(inputDir, avaDir=avaDir)

# make comparison plots
damBreak.plotComparison(dataComSol, hL, xR, hR, uR, dtAnalysis, cfgMain)
Пример #2
0
cfgFP = cfg['FPSOL']

# for timing the sims
startTime = time.time()
# create output directory for test result plots
outDirTest = os.path.join(avalancheDir, 'Outputs', 'ana1Tests')
fU.makeADir(outDirTest)

# Define release thickness distribution
demFile, relFiles, entFiles, resFile, flagEntRes = gI.getInputData(
    avalancheDir, cfg['FLAGS'])
relDict = FPtest.getReleaseThickness(avalancheDir, cfg, demFile)
relTh = relDict['relTh']

# call com1DFA to perform simulation - provide configuration file and release thickness function
Particles, Fields, Tsave, dem, plotDict, reportDictList = runCom1DFA.runCom1DFA(
    avaDir=avalancheDir, cfgFile=FPCfg, relThField=relTh)
relDict['dem'] = dem
# +++++++++POSTPROCESS++++++++++++++++++++++++
# option for user interaction
if cfgFP.getboolean('flagInteraction'):
    showPlot = True
    value = input("give time step to plot (float in s):\n")
else:
    showPlot = cfgMain['FLAGS'].getboolean('showPlot')
    value = cfgFP.getfloat('dtSol')
try:
    value = float(value)
except ValueError:
    value = 'n'
while isinstance(value, float):
    ind_t = min(np.searchsorted(Tsave, value), len(Tsave) - 1)
Пример #3
0
    # Generata plots for all peakFiles
    modNameOrig = 'com1DFAOrig'
    plotDictcom1DFAOrig = oP.plotAllPeakFields(avaDir, cfgCom1DFAOrig,
                                               cfgMain['FLAGS'], modNameOrig)

    # Set directory for com1DFA report
    reportDirOrig = os.path.join(outDir, 'com1DFAOrig', 'reports')
    # write report
    gR.writeReport(reportDirOrig, reportDictListcom1DFAOrig, cfgMain['FLAGS'],
                   plotDictcom1DFAOrig)

    #####################################################################
    # ######################### Run Com1DFA #############################
    # Run python DFA
    # call com1DFA to perform simulation - provide configuration file and release thickness function
    _, _, _, _, plotDictcom1DFA, reportDictListcom1DFA = runCom1DFA.runCom1DFA(
        avaDir=avaDir, cfgFile='', relThField='')

    # Set directory for com1DFA report
    reportDir = os.path.join(outDir, 'com1DFA', 'reports')
    # write report
    gR.writeReport(reportDir, reportDictListcom1DFA, cfgMain['FLAGS'],
                   plotDictcom1DFA)

    #######################################################
    # ########### Analyze results ##########################
    # Aimec analysis
    # load configuration
    cfgAimec = cfgUtils.getModuleConfig(ana3AIMEC)
    initProj.cleanModuleFiles(avaDir, ana3AIMEC)
    # get release area scenarios
    relArea = []
Пример #4
0
    # Fetch benchmark test info
    benchDict = simParametersDict.fetchBenchParameters(test['NAME'])
    simNameRef = test['simNameRef']
    refDir = pathlib.Path('..', 'benchmarks', test['NAME'])

    # Clean input directory(ies) of old work and output files
    initProj.cleanSingleAvaDir(avaDir, keep=logName)

    # Load input parameters from configuration file for standard tests
    # write config to log file
    avaName = os.path.basename(avaDir)
    standardCfg = os.path.join('..', 'benchmarks', test['NAME'],
                               '%s_com1DFACfg.ini' % test['AVANAME'])

    particlesList, fieldsList, Tsave, dem, plotDict, reportDictList = runCom1DFA.runCom1DFA(
        avaDir=avaDir, cfgFile=standardCfg, relThField='', variationDict='')

    modName = 'com1DFA'

    # Fetch correct reportDict according to parametersDict
    simNameComp = cfgUtils.filterSims(avaDir, parametersDict, com1DFA)
    if len(simNameComp) > 1:
        log.error('more than one matching simulation found for criteria! ')
    else:
        simNameComp = simNameComp[0]

    for dict in reportDictList:
        if simNameComp == dict['simName']['name']:
            reportD = dict

    # set result files directory