|
[Sponsors] |
Fixing U with vectorCodedSource via fvOptions |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 21, 2020, 18:36 |
Fixing U with vectorCodedSource via fvOptions
|
#1 |
Senior Member
René Thibault
Join Date: Dec 2019
Location: Canada
Posts: 114
Rep Power: 7 |
Hi foamers,
I try to fix the value of U at the first cell of the domain (from the wall) via the fvOptions framework by using the function ''vectorCodedSource'. I don't know what I'm doing wrong. The turbulence model compute and I don't get any message of error whatsoever. But, when I look at the result during the couple of first iteration, the value of U at the specify cell is not what I fixed. I used the 'topoSetDict' in order to make a selection of the cells that I want to apply the condition on. To put you in context, in order to simplify the problem, I applied the fix value at the first cell center to a 1D simulation first (the domain is x=1mm, y=150mm(dy=1mm), z=1mm) and then, it will extend to a 2D simulation after. The value of U will be determine by a formula later on. If you guys have suggestions, let me know. It would be really appreciated! Here are the code: topoSetDict: Code:
actions ( // U firstCellFix { name firstCellFixU; type cellSet; action new; source boxToCell; box (0 0 0) (0.001 0.001 0.001); } { name firstCellU; type cellZoneSet; action new; source setToCellZone; set firstCellFixU; } ); Code:
fixU { type vectorCodedSource; active true; selectionMode cellSet; cellSet firstCellU; fields (U); name Ufix; codeSetValue #{ cellSet selectedCells(mesh_, cellSetName_); labelList cells = selectedCells.toc(); vectorField values(cells.size()); forAll(cells, i) { values[i].x() = 1.458; values[i].y() = 0.0; values[i].z() = 0.0; }; eqn.setValues(cells, values); #}; } Thank you very much for your helps! Last edited by Tibo99; July 21, 2020 at 22:16. |
|
January 20, 2022, 15:48 |
|
#2 |
Senior Member
|
Dear René,
Did you solve the problem? I tried to fix the velocity at some specific cells but failed. It seems the velocity is changed by setValues(cells, values), but it is not the value as specified. If you have figured out the issue, could you please share your solution? Kind regards, Michael |
|
January 25, 2022, 11:48 |
|
#3 |
Senior Member
René Thibault
Join Date: Dec 2019
Location: Canada
Posts: 114
Rep Power: 7 |
I was able to make it work, but maybe its not the way you looking for.
Hope this will help you. topoSetDict: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1906 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object topoSetDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // actions ( // U firstCellFix { name firstCellFixU; type cellSet; action new; source boxToCell; box (0 0 0) (0.001 0.001 0.001); } { name firstCellU; type cellZoneSet; action new; source setToCellZone; set firstCellFixU; } ); // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1906 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // fixU { type vectorFixedValueConstraint; active true; selectionMode cellZone; cellZone firstCellU; volumeMode absolute; fieldValues { U (5.1053110026 0 0); } } // ************************************************************************* // |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can I use fvOptions to couple a solid region and a fluid region? | titanchao | OpenFOAM Running, Solving & CFD | 4 | January 14, 2022 08:55 |
cannot use fvOptions vectorCodedSource in parallel simulation | Sgs | OpenFOAM Running, Solving & CFD | 3 | October 13, 2020 01:36 |
What are the units used in the thermophysicalProperties and fvOptions dictionaries? | ophr | OpenFOAM Pre-Processing | 2 | June 16, 2019 02:29 |
Configuration of boundary conditions and fvOptions file | Raza Javed | OpenFOAM Running, Solving & CFD | 16 | May 3, 2019 17:35 |
cellSet volume in fvOptions | pablo_fil | OpenFOAM Running, Solving & CFD | 6 | April 21, 2017 05:47 |