|
[Sponsors] |
dynamics Mesh Refinement based on vector field in openfoam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 23, 2020, 09:47 |
dynamics Mesh Refinement based on vector field in openfoam
|
#1 |
Senior Member
Mehdi Babamehdi
Join Date: Jan 2011
Posts: 158
Rep Power: 15 |
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 |
|
January 23, 2020, 10:06 |
|
#2 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,754
Rep Power: 66 |
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).
|
|
January 23, 2020, 10:50 |
|
#3 |
Senior Member
Mehdi Babamehdi
Join Date: Jan 2011
Posts: 158
Rep Power: 15 |
Thanks for your help. This is the primary question, what is the key word for velocity magnitude in openfoam. I mean
Code:
mag(U) Code:
U.magnitude() Last edited by mb.pejvak; January 23, 2020 at 11:26. Reason: Add more info |
|
January 23, 2020, 14:17 |
|
#4 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,754
Rep Power: 66 |
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. |
|
Tags |
dynamic mesh adaption, openfaom-5, vector of velocity |
|
|
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 |