openfoam tips & tricks

Download OpenFOAM Tips & Tricks

Post on 21-Jan-2016

630 views

Category:

Documents

12 download

Embed Size (px)

TRANSCRIPT

  • OpenFOAM Tips & Tricks - 1st OpenFOAM Korea Users

    Community Conference

    2012. 10. 18( )

  • . utilities,boundaryconditions,functions,etc...

    Preprocessing Solversetup&solving postprocessing

  • Pre-processing

  • Mesh generation BlockMesh SnappyHexMesh

    BlockMesh SnappyHexMesh BlockMeshDict,snappyHexMeshDict Stlfile Featureline(OF2.x)

  • SnappyHexMesh featureline

    featurelineextract surfaceFeatureExtract[options] surfaceFeatureExtractincludedAngle150writeObj

    ./constant/triSurface/stator.stl./stator

    featurelineconvert surfaceFeatureConvert[options] surfaceFeatureConvertstator.eMeshstator.obj

    ***.obj paraview ***.eMesh snappyHexMesh featureline

  • Mesh file convert fluentMeshToFoam[options] Options

    scale,writeZones,writeSets

    Meshfile 2dor3dmsh,casfileasciitypeonly

    Example fluentMeshToFoamscale0.001writeZones../test.msh

    fluent3DMeshToFoam

  • Mesh file convert StarCCM+

    ccm26ToFoam

    Plot3d plot3dToFoam[options] Options

    2D,noBlank,scale Example

    Plot3dToFoamnoBlankscale0.001test.grd

  • Scale, translate, rotate transformPoints[options] Options

    parallel,region,rollPitchYaw,rotate,rotateFields,scale,translate

    Example transformPointsscale(0.0010.0010.001) transformPointstranslate(100) transformPointsrotate((100)(001))

  • Point,face,cell handling checkMesh

    checkMesh>checkMeshResults&

    tailfcheckMeshResults

    sets setsofpoints,faces,cells

    zones zonesofpoints,faces,cells

    regions regionsofmeshes

    constant/polyMesh boundary points faces neighbour owner pointZones faceZones cellZones sets(directory)

  • Point,face,cell handling setSet

    Interactiveorbatchjob Batchjob:setSetbatch

    setcommand cellSet|faceSet|pointSet

    action list,clear,invert,remove,new,add

    ,delete,subset

  • Point,face,cell handling setSetexample

    Wrongorientedface highskewface cell set

    SetSetbatchbatchFileExample

    batchFileExample cellSettestnew

    cellSettestaddfaceToCellwrongOrientedFacesany

    cellSettestaddfaceToCellskewFacesany

    quit

    Makezonesfromsets setsToZonesnoFlipMap

    pointsZones,faceZones,cellZones

  • Point,face,cell handling topoSet[options]

    set options

    latestTime,noZero,time,parallel,region,

    system/topoSetdict

    topoSetDictexample

    actions

    (

    {

    name cell1;//anyname

    type cellSet;//pointSet,faceSet

    action new;//add,delete...

    source cylinderToCell;//boxToCell...

    sourceInfo

    {p1(0.50.50.5);

    p2(0.60.50.5);

    radius0.1;}

    }

    );

  • Mesh handling mergeMeshes

    mergeMeshes[options]

    Example mergeMeshesstatorrotor(OF21) mergeMeshes.stator.rotor(OF16ext)

    system/controlDict functionObjects subsetMesh

    subsetMesh[options]

    splitMeshRegions[options] Options:cellZones,cellZonesFileOnly,cellZonesOnly,overwrite

    regionCellsets:of16extonly,cellZones constant/polyMesh/sets cellregion .

  • Bad cell remove checkMesh

    wrongOrientedFaces,skewFaces,zeroVolumeCells,nonOrthoFaces,zeroAreaFaces constant/polyMesh/sets/

    setSet cell setSetbatchbatchFile

    batchFile cellSetzeroVolumeCellsinvert

    cellSetzeroVolumeCellssubset

    quit

    subsetMeshzeroVolumeCellsoverwrite

    oldInternalFaces patch type symmetryPlane

  • GGI interface int1,int2 ggi

    setSet faceSet .

    setSetbatch

    batchfile faceSetleftZonenewpatchToFaceint1

    faceSetrightZonenewpatchToFaceint2

    faceSet zone . setsToZonesnoFlipMap

    constant/polyMesh/boundary 0/

    int1

    {type ggi;}

    constant/polyMesh/boundary int1

    {type ggi;

    nfaces 299;

    startFace 988976;

    shadowPatch int2;

    zone leftZone;

    bridgeOverlap false;}

    int2

    {type ggi;

    nfaces 333;

    startFace 989000;

    shadowPatch int1;

    zone rightZone;

    bridgeOverlap false;}

  • Cyclic ggi / overlap ggi rotor1 rotor2 rotor1

    {

    type cyclicGgi;

    nface 2344;

    startFace 234666;

    shadowPatch rotor2;

    zone rotor1Zone;

    bridgeOverlap off;

    rotationAxis (001);

    rotationAngle 60;

    separationOffset off;

    }

    rotor_in stator_out

    rotor_in

    {

    type overlapGgi;

    nface 2344;

    startFace 234666;

    shadowPatch stator_out;

    zone rotor_in_zone;

    rotationAxis (001);

    ncopies 6;

    }

  • AMI interface constant/polyMesh/boundary

    AMI1

    {

    type cyclicAMI;

    nfaces 22416;

    startFace 177343;

    matchTolerance 0.0001;

    neighbourPatch AMI2

    transform noOrdering;

    }

  • Patch handling autoPatch[options]

    featureangle Example

    autoPatchoverwrite90

    createPatch[options] createPatchDict patch Example

    createPatchoverwrite

  • Patch handling createPatchexample

    topoSet faceSet createPatch

    topoSet createPatch

    topoSetDict

    actions

    (

    {

    name waterin;

    type faceSet;

    action new;

    source boxToFace;

    sourceInfo {box(151110)(14.61.00.34);}

    }

    );

    createPatchDict

    matchTolerance 1e3;

    pointSync true;

    patches

    (

    {

    name waterInlet;

    patchInfo

    { type patch;}

    constructFrom set;

    set waterin;

    }

    );

  • Solver setup & solving

  • Boundary conditions fixedValue

    type fixedValue;

    value uniform(000);

    zeroGradient

    type zeroGradient;

    surfaceNormalFixedValue

    type surfaceNormalFixedValue;

    refValue uniform1;

    value uniform(000);

    fixedMeanValue

    type fixedMeanValue;

    meanValue 1;

    pressureInletOutletVelocity

    type pressureInletOutletVelocity;

    value uniform(000);

    inletOutlet

    type inletOutlet;

    inletValue uniform(000);

    value uniform(000);

  • Boundary conditions flowRateInletVelocity

    type flowRateInletVelocity;

    flowRate 0.1;

    value uniform(000);

    totalPressure

    type totalPressure;

    gamma 1.4;

    p0 uniform101325;

    outletMappedUniformInlet

    type outletMappedUniformInlet;

    outletPatchName out;

    field CH4

    value uniform0.1;

    AtmboundaryLayerInletVelocity

    type atmBoundaryLayerInletVelocity;

    Uref 1.2

    Href 300;

    n (100);

    z (001);

    z0 uniform0.03;

    value uniform(100);

    zGround uniform323;

  • Boundary conditions Heattransfercoeff.

    type wallHeatTransfer;

    Tinf uniform300;

    alphaWall uniform1e5;

    value uniform5;

    heatflux

    typecompressible::turbulentHeatFluxTemperature;

    heatSource flux;//power

    q uniform10;

    K basicThermo;

    value uniform300;

    KName none;

    mixed

    fixedEnthalpy

    fixedInternalEnergy

    gradientEnthalpy

    gradientInternalEnergy

    mixedEnthalpy

    mixedInternalEnergy

    totalTemperature

    externalWallHeatFluxTemperature

    compressible::turbulentTemperatureCoupledBaffle

    compressible::turbulentTemperatureRadCoupledMixed

  • Time dependent B.C. From2.1.0

    UniformFixedValue

    FlowRateInletVelocity

    UniformTotalPressure

    oscillating...

    Example1

    type uniformFixedValue;

    uniformValue table

    (

    (0 0.1)

    (100 10.0)

    );

    Example2

    type flowRateInletVelocity;

    flowRate table

    (

    (01.0)

    (13.0)

    );

    Example3

    type uniformTotalPressure;

    pressure table

    ((010)(140));

    p0 40;

    U U

    phi phi

    gamma 1.4;

    value uniform40;

  • Boundary conditions groovyBC

    swak4Foam

    keyword type:groobyBC

    variable: , ;, valueExpression:C++

    Example1type groovyBC;

    variables "con{out}=sum(CH4*mag(Sf()))/sum(mag(Sf()));";

    valueExpression "con";

    value uniform0.1;

    Example2type groovyBC;

    variables "ccc=time()*0.1;";

    valueExpression "ccc";

    value uniform0;

  • codeStream OF2.1,Boundarycondition,source,

    controlDict Value #codeStream

    #{#}

    Example

    scalarExplicitSourceCoeffs

    {

    volumeMode specific;

    injectionRate

    {S #codeStream

    {code #{scalar aa=100;scalar bb=10;os

  • turbulence Constant

    turbulenceProperties laminarRASModel,LES

    RASProperties kepsilon,kOmega,SpalartAllmaras...

    0 k,epsilon,omega

    nuTilda(SA)

    nut,mut,alphat

    roughWallFunction

    nut

    type nutRoughWallFunction;

    Ks 9;

    Cs 0.3;

    value uniform0;

    wallfunction k:fixedValue0

    omega:compressible::omegaWallFunction

    mut mutLowReWallFunction

    zeroGradient(OF16ext)

    alphat alphatJayatillekeWallFunction

    zeroGradient(OF16ext)

  • Convergence criteria FvSolution SIMPLEdictionary Example

    SIMPLE

    {

    nNonOrthogonalCorrectors 1;

    residualControl

    {

    p 1e5;U 1e5;k 1e5;epsilon 1e5;

    }

    }

  • parallel decomposePar

    Type:scotch,metis,simple,patchConstrained...

    ggidecompose:decomposeParDict ggi globalFaceZones

    globalFaceZones(leftZonerightZone);

    patchContrainedexample

    type patchConstrained;

    patchConstrai