Esempio n. 1
0
        IOHbO2ParametersStraightCapillaries.dependentVariables)
    # no dependent variables are defined in HbO2SimulationParameters
    dependentVariables['CFL'] = ['deltaT']
    dependentVariables['dx'] = ['deltaT']
    dependentVariables['RBCVelocity'] = ['deltaT']

    def __init__(self, case_path='.'):
        super(IOHbO2SimulationParametersStraightCapillaries,
              self).__init__(case_path)


if __name__ == "__main__":
    from HbO2.setup.case import SimulationParametersFactory
    simParams = SimulationParametersFactory().make_sim_params(
        '.', use_numerics=True)
    if isAxisymmetricCase('.'):
        print "Computed deltaT: %g" % simParams['deltaT']
        print simParams
        print "RBC length after setting the radiusRBC to radiusPlasma:"
        simParams['radiusRBC'] = simParams['radiusPlasma']
        print simParams['RBCLength'], simParams['RBCHalfLength']
        print "RBC length after increasing RBC volume:"
        simParams['RBCVolume'] = 69e-18
        print simParams['RBCLength'], simParams['RBCHalfLength']
        simParams.update_files()
    elif isGraphCase('.'):
        print "Computed PO2Tissue: {:g}".format(simParams['PO2Tissue'])
        print "Computed HbInit: {:g}".format(simParams['HbInit'])
        print "Computed deltaT: {:g}".format(simParams['deltaT'])
        simParams.update_files()
Esempio n. 2
0
time_extend = args.time_extend
averaging_time = args.averaging_time

sim_params = SimulationParametersFactory().make_sim_params(case_path,
                                                           use_numerics=True)

domain_path = os.path.join(case_path, 'domain')
last_time_str = copy_const_fields_first_to_last(domain_path)
last_time = float(last_time_str)

# adapt the end time and the averaging start
end_time = last_time + time_extend
if averaging_time > time_extend:
    raise RuntimeError(
        'The averaging window length cannot be smaller than the additional time.'
    )
sim_params['endTime'] = end_time
sim_params['timeStart'] = end_time - averaging_time
sim_params.update_files()
print "endTime:   {:g}".format(sim_params['endTime'])
print "timeStart: {:g}".format(sim_params['timeStart'])

# rename the averaging properties file
try:
    file_path = os.path.join(domain_path, last_time_str, 'uniform',
                             average_property_filepath)
    file_path_bak = file_path + '.bak'
    shutil.move(file_path, file_path_bak)
except:
    print 'Could not move the averaging properties file {:s}'.format(file_path)