CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

dynamics Mesh Refinement based on vector field in openfoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 23, 2020, 09:47
Default dynamics Mesh Refinement based on vector field in openfoam
  #1
Senior Member
 
Mehdi Babamehdi
Join Date: Jan 2011
Posts: 158
Rep Power: 15
mb.pejvak is on a distinguished road
I am using interDyMFoam as a solve and I want to have dynamic mesh rifinement based on velocity. The dynamicMeshDict is as follows:
Code:
 



/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.0.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh   dynamicRefineFvMesh;

dynamicRefineFvMeshCoeffs
{
    // How often to refine
    refineInterval  1;
    // Field to be refinement on
    field U;
    // Refine field between lower..upper
    lowerRefineLevel 0.0
    upperRefineLevel 0.001;
    // If value < unrefineLevel unrefine
    unrefineLevel   0.1;
    // Have slower than 2:1 refinement
    nBufferLayers   24;
    // Refine cells only up to maxRefinement levels
    maxRefinement   2;
    // Stop refinement if maxCells reached
    maxCells        100000000;

    // Stop autorefinement after n timesteps
    maxTimeAutoRefine   -1;

    // Flux field and corresponding velocity field. Fluxes on changed
    // faces get recalculated by interpolating the velocity. Use 'none'
    // on surfaceScalarFields that do not need to be reinterpolated.
    correctFluxes
    (
        (phi_0 U)
        (phi U)
    );
    // Write the refinement level as a volScalarField
    dumpLevel       false;
}


// ************************************************************************* //

But when I run the case I got the error

Code:
  it is not a volScalarField, it is a volVectorField
mb.pejvak is offline   Reply With Quote

Old   January 23, 2020, 10:06
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,762
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
The error says it all... U is a velocity field. Refinement is based on a yes/no criteria (more specifically, a scalar field with values between lowerRefineLevel and upperRefineLevel)... Supply a scalar field (i.e. one of the components of velocity or the velocity magnitude).
LuckyTran is offline   Reply With Quote

Old   January 23, 2020, 10:50
Default
  #3
Senior Member
 
Mehdi Babamehdi
Join Date: Jan 2011
Posts: 158
Rep Power: 15
mb.pejvak is on a distinguished road
Thanks for your help. This is the primary question, what is the key word for velocity magnitude in openfoam. I mean

Code:
 mag(U)
or

Code:
 U.magnitude()
work or I have to do some coding

Last edited by mb.pejvak; January 23, 2020 at 11:26. Reason: Add more info
mb.pejvak is offline   Reply With Quote

Old   January 23, 2020, 14:17
Default
  #4
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,762
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
You do have to do some coding. Velocity magnitude is (usually) not a registered field available at runtime.

If you tried it anyway right now, you'd probably get the error that it cannot find the field mag(U). I don't know exactly how you're using your solver and how often the mesh needs updating to actually present you the solution but..
there is a library of field function objects (one of them is mag) that can calculate the magnitude at runtime and write it into a volScalarField. You put this into your control dict.


If you don't need to refine the mesh during runtime, you could get away with just using the postProcess utility. But I can imagine nobody using a dynamic mesh is doing refinement this way.
LuckyTran is offline   Reply With Quote

Reply

Tags
dynamic mesh adaption, openfaom-5, vector of velocity


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SimpleFoam & Theater jipai OpenFOAM Running, Solving & CFD 3 June 18, 2019 11:11
[snappyHexMesh] Snappy Hex Mesh - issue with smoothness of the model edges olek.warc OpenFOAM Meshing & Mesh Conversion 1 August 31, 2018 12:31
[snappyHexMesh] Edge Refinement fracasce OpenFOAM Meshing & Mesh Conversion 3 December 2, 2017 14:30
OpenFOAM v3.0+ ?? SBusch OpenFOAM 22 December 26, 2016 15:24
[snappyHexMesh] crash sHM H25E OpenFOAM Meshing & Mesh Conversion 11 November 10, 2014 12:27


All times are GMT -4. The time now is 04:00.