|
[Sponsors] |
using setValues and creating a UList for argument |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 29, 2019, 00:33 |
using setValues and creating a UList for argument
|
#1 |
Member
Ashish Magar
Join Date: Jul 2016
Location: Mumbai, India
Posts: 81
Rep Power: 9 |
Hello everyone.
I was trying to impose a fixed velocity(cell by cell) to a cellZone, by using setValues from fvMatrix. I created a labelList of cells from their IDs, however I am stuck as how to proceed further. Can anyone help ..? Thank you. |
|
January 29, 2019, 02:51 |
|
#2 |
Member
Ashish Magar
Join Date: Jul 2016
Location: Mumbai, India
Posts: 81
Rep Power: 9 |
Anyway Solved..!!
|
|
January 19, 2022, 20:15 |
Can you help me out?
|
#3 |
Senior Member
|
Dear Ashish,
Can you explain how you get it solved? I use the following code to change the velocity if the cells are in the cylinder centered at a specific point. I observe the U is changed around the point but it is not 0 as specified. I have been stuck in this for a while. Can you please point out the errors? Thanks in advance! Code:
FoamFile { version 2.0; format ascii; class dictionary; location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // codedSource { type vectorCodedSource; selectionMode all; fields (U); name codedSource; codeConstrain #{ const vector& pt = vector(0.1, 0, 0.01) ; const vectorField center = mesh().C(); labelList cells; forAll(center, i) { const vector ds = pt - center[i]; scalar d = sqrt(ds.x() * ds.x() + ds.y() * ds.y()); if (d <= 0.009) { Info << "I=" << i << endl; cells.append(i); } }; vectorField values(cells.size()); Info << "Cells selected: " << cells << endl; values = vector(0, 0, 0); eqn.setValues(cells, values); #}; codeCorrect #{ #}; codeAddSup #{ #}; code #{ $codeInclude $codeCorrect $codeAddSup $codeSetValue #}; } |
|
January 22, 2022, 07:55 |
|
#4 |
Member
Ashish Magar
Join Date: Jul 2016
Location: Mumbai, India
Posts: 81
Rep Power: 9 |
This was tricky. I did modify interFoam-> Ueqn.H as that suited my purpose.
I had to call setValues once again after the pressure correction was done and that solved my problem. |
|
January 22, 2022, 10:42 |
|
#5 |
Senior Member
|
Thank you for your reply! I guess the U field is corrected by the silver due to conservation. In my case, I tried to fix the velocities of a chunk of fluid cells which does not make sense in practice( just for testing). If I just fix one cell of some separate cells, it is possible to adjust the flow field to satisfy the mass and momentum conservation to fix the velocity at these cells.
So it makes sense you setValue again after the pressure correction which seems not possible in fvOptions. |
|
|
|