Ejemplo n.º 1
0
def main(case_dir='joinSTL', runRhoCentral = False):
    #Create a new case file, raise an error if the directory already exists
    case = create_new_case(case_dir)
    write_control_dict(case)
    #write the base block mesh
    make_block_mesh(case)
    parts = load_multiple_geometries(GeometryFormat.STL,path_list,part_list,case)
    snap = SnappyHexMesh(parts,4,case)
    ###############un-comment out the code snippet below if you want to apply extra refinement#########
    #snap.refinementSurfaceMin =7
    #snap.maxGlobalCells=20000000
    #snap.refinementSurfaceMax =8
    #snap.distanceLevels = [7,6,4,2]
    #snap.distanceRefinements = [0.01,0.02,0.06,0.2]
    #snap.snap=True
    #snap.snapTolerance = 8
    #snap.edgeRefinementLevel = 8
    ###############un-comment out the code snippet below if you want to apply extra refinement#########
    snap.locationToKeep = [0.0012,0.124,0.19] #odd numbers to ensure not on face
    snap.addLayers=False
    #we need to write fvSchemes and fvSolution to be able to use paraForm and run snappy?
    write_fv_schemes(case)
    write_fv_solution(case)
    write_thermophysical_properties(case)
    write_turbulence_properties(case)
    write_initial_conditions(case)
    snap.generate_mesh()
    getTrueMesh(case)
    if runRhoCentral:
        case.run_tool('rhoCentralFoam')
Ejemplo n.º 2
0
def main(case_dir='snappy'):
    #Create a new case file, raise an error if the directory already exists
    case = create_new_case(case_dir)
    write_control_dict(case)
    #write the base block mesh
    make_block_mesh(case)

    rocket = Geometry(GeometryFormat.STL,'STLS/example.stl','example',case)
    rocket.scale(0.5);
    rocket.translate([0.5,2,2])
    
    snap = SnappyHexMesh([rocket],4,case)
    snap.snap=True
    snap.snapTolerance = 8;
    snap.locationToKeep = [0.0012,0.124,0.19] #odd numbers to ensure not on face
    snap.addLayers=False
    #we need to write fvSchemes and fvSolution to be able to use paraForm and run snappy?
    write_fv_schemes(case)
    write_fv_solution(case)
    snap.generate_mesh()