|
[Sponsors] |
October 17, 2012, 02:38 |
Need to define a particular field
|
#1 |
Member
Simone
Join Date: Sep 2012
Posts: 95
Rep Power: 13 |
Hi to everyone!
I need to define a new scalar field but just over a patch that represents an airfoil and later I want to be able to see it in paraFoam. Which is a possible solution to do that? I've been looking for something similar but I can't find anything. Cheers, Simone |
|
October 18, 2012, 04:53 |
|
#2 |
Senior Member
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17 |
Hey Simione,
define yourself a new volScalarField Code:
volScalarField myField ( IOobject ( "myField", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, 0. ); Get to your airfoil patch Code:
word patchName = "airfoil"; //or whatever label patchID = mesh.boundary().findPatchID(patchName); Code:
const fvBoundaryMesh& bdy = mesh.boundary(); label patchID = -1; forAll (bdy, patchI) { if (bdy[patchI].name() == "freeSurface") { patchID = patchI; } } Code:
myField.boundaryField()[patchID] = /*put your computation here*/; Hope this helps... |
|
October 18, 2012, 05:11 |
|
#3 |
Member
Simone
Join Date: Sep 2012
Posts: 95
Rep Power: 13 |
kathrin_kissling,
thank you really much for your answer. I'll try your advice soon and let you know if it works! By the way I've got also another trouble now: I know that there is fvc::interpolate function to get the value of a volumeField on to a surfaceField. But my question is: is there a function that can interpolate the value of a surfaceField on to a volumeField?? I really need it right now. Thanks for your help Simone |
|
October 18, 2012, 06:10 |
|
#4 | ||
Member
Simone
Join Date: Sep 2012
Posts: 95
Rep Power: 13 |
It doesn't work . Here's the error:
Quote:
Quote:
|
|||
October 18, 2012, 06:16 |
|
#5 |
Member
Simone
Join Date: Sep 2012
Posts: 95
Rep Power: 13 |
Now everything is ok! I had put the wrong name for the patch . Now it remains the problem about interpolation..
Any suggestion is really appreciated!! |
|
October 18, 2012, 06:29 |
|
#6 |
Senior Member
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17 |
fvc::average will do the trick!
directly from fvcAverage.H: Area-weighted average a surfaceField creating a volField Best Kathrin |
|
October 18, 2012, 08:13 |
|
#7 |
Member
Simone
Join Date: Sep 2012
Posts: 95
Rep Power: 13 |
Thanks again!!
If I want to evaluate some variable only on the patch just defined, let's say U, I only have to do something like: mypatch.boundaryField()[patchID]= U.boundaryField()[patchID]... right? |
|
October 18, 2012, 10:48 |
|
#8 |
Member
Simone
Join Date: Sep 2012
Posts: 95
Rep Power: 13 |
And, by the way, how would you impose a set of "nonuniform" but fixedValue BC over a patch?
What I need is, substantially, to impose different normal velocities over an airfoil. Cheers Simone |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
problems after decomposing for running | alessio.nz | OpenFOAM | 7 | March 5, 2021 04:49 |
How to define multiple boundary field names | waku2005 | OpenFOAM | 4 | May 9, 2011 08:28 |
Missing math.h header | Travis | FLUENT | 4 | January 15, 2009 11:48 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 06:51 |
REAL GAS UDF | brian | FLUENT | 6 | September 11, 2006 08:23 |