def test_buildCase():
    # directory of the base case

    baseCase = 'testCase'
    cwd = os.getcwd()
    dir_path = os.path.dirname(os.path.realpath(__file__))
    os.chdir(dir_path)
    # list of parent, child and grandchild names
    caseStructure = [['Ux1', 'Ux3'], ['T1'], ['p1'], ['string10']]

    # dictionarys with data for the caseData dictionary
    update_Ux1 = {
        '0/U': {
            'boundaryField': {
                'inlet': {
                    'value': 'uniform (1 0 0)'
                }
            }
        }
    }

    update_Ux2 = {
        '0/U': {
            'boundaryField': {
                'inlet': {
                    'value': 'uniform (2 0 0)'
                }
            }
        }
    }

    update_Ux3 = {
        '0/U': {
            'boundaryField': {
                'inlet': {
                    'value': 'uniform (3 0 0)'
                }
            }
        }
    }

    update_T1 = {'0/T': {'boundaryField': {'inlet': {'value': 'uniform 1'}}}}

    update_T2 = {'0/T': {'boundaryField': {'inlet': {'value': 'uniform 2'}}}}

    update_T3 = {'0/T': {'boundaryField': {'inlet': {'value': 'uniform 3'}}}}

    update_T4 = {'0/T': {'boundaryField': {'inlet': {'value': 'uniform 4'}}}}

    update_p1 = {
        '0/p': {
            'boundaryField': {
                'inlet': {
                    'value': 'uniform (1 0 0)'
                }
            }
        }
    }

    update_p2 = {
        '0/p': {
            'boundaryField': {
                'inlet': {
                    'value': 'uniform (2 0 0)'
                }
            }
        }
    }

    update_string10 = {
        'system/stringTest.txt': {
            '#!stringManipulation': {
                'STRINGMARKER': '10'
            }
        }
    }

    update_string20 = {
        'system/stringTest.txt': {
            '#!stringManipulation': {
                'STRINGMARKER': '20'
            }
        }
    }

    # dictionary of data to update
    caseData = {
        'Ux1': update_Ux1,
        'Ux2': update_Ux2,
        'Ux3': update_Ux3,
        'T1': update_T1,
        'T2': update_T2,
        'T3': update_T3,
        'T4': update_T4,
        'p1': update_p1,
        'p2': update_p2,
        'string10': update_string10,
        'string20': update_string20
    }

    # generate cases
    casefoam.mkCases(baseCase,
                     caseStructure,
                     caseData,
                     hierarchy='tree',
                     writeDir='Cases')

    os.chdir(cwd)
Exemple #2
0
    }


res = np.logspace(math.log10(25), math.log10(600), 10)
res = res.astype(int)
# dictionary of data to update
caseData = {
    'gradAlpha': update_gradAlpha,
    'RDF': update_RDF,
    'fitParaboloid': update_fitParaboloid,
    'heightFunction': update_heightFunction,
    'hex': update_hex,
    'Grid1': changeBlockMesh(res[0]),
    'Grid2': changeBlockMesh(res[1]),
    'Grid3': changeBlockMesh(res[2]),
    'Grid4': changeBlockMesh(res[3]),
    'Grid5': changeBlockMesh(res[4]),
    'Grid6': changeBlockMesh(res[5]),
    'Grid7': changeBlockMesh(res[6]),
    'Grid8': changeBlockMesh(res[7]),
    'Grid9': changeBlockMesh(res[8]),
    'Grid10': changeBlockMesh(res[9])
}

# generate cases
casefoam.mkCases(baseCase,
                 caseStructure,
                 caseData,
                 hierarchy='tree',
                 writeDir='Cases')
            'STRINGMARKER': '10'
        }
    }
}

update_string20 = {
    'system/stringTest.txt': {
        '#!stringManipulation': {
            'STRINGMARKER': '20'
        }
    }
}

# dictionary of data to update
caseData = {
    'Ux1': update_Ux1,
    'Ux2': update_Ux2,
    'Ux3': update_Ux3,
    'T1': update_T1,
    'T2': update_T2,
    'T3': update_T3,
    'T4': update_T4,
    'p1': update_p1,
    'p2': update_p2,
    'string10': update_string10,
    'string20': update_string20
}

# generate cases
casefoam.mkCases(baseCase, caseStructure, caseData, hierarchy='tree')