CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Setting boundaryField for a volScalarField

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 24, 2011, 14:59
Default Setting boundaryField for a volScalarField
  #1
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Dear Foamers,

I try to set the value for a volScalarField like this:

Code:
forAll( alpha1.boundaryField()[myWaterWaves.patchID], facei)
{
  alpha1.boundaryField()[myWaterWaves.patchID][facei].operator=(1.);
}
It generates this error:

Code:
calcWaterWaves.H:39:63: error: request for member ‘operator=’ in ‘((Foam::fvPatchField<double>*)((Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField*)alpha1.Foam::GeometricField<Type, PatchField, GeoMesh>::boundaryField [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]())->Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::<anonymous>.Foam::FieldField<Foam::fvPatchField, double>::<anonymous>.Foam::PtrList<T>::operator[] [with T = Foam::fvPatchField<double>, Foam::label = int](myWaterWaves.Foam::waterWaves::patchID))->Foam::fvPatchField<double>::<anonymous>.Foam::Field<double>::<anonymous>.Foam::List<double>::<anonymous>.Foam::UList<T>::operator[] [with T = double, Foam::label = int](facei)’, which is of non-class type ‘double’
/opt/openfoam200/src/finiteVolume/lnInclude/readTimeControls.H:38:8: warning: unused variable ‘maxDeltaT’
make: *** [Make/linux64GccDPOpt/waveTankFoam.o] Error 1
The method I posted was successful for a volVectorField. However, no luck for me with understanding what is wrong here?

Regards,
Hisham
Hisham is offline   Reply With Quote

Old   October 25, 2011, 03:32
Default
  #2
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17
kathrin_kissling is on a distinguished road
Hi,

can you just try to skip ".operator"

Code:
forAll( alpha1.boundaryField()[myWaterWaves.patchID], facei)
{
  alpha1.boundaryField()[myWaterWaves.patchID][facei]=(1.);
}
Then it will set these values to 1.

Best

Kathrin
kathrin_kissling is offline   Reply With Quote

Old   October 25, 2011, 07:50
Default
  #3
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Hi Kathrin,

Thanks a lot!

It has compiled without the (.operator). However, it does not behave as I've expected (the value is not applied at the BC). The "==" compiles as well (which is the forced assignment I believe), but it does not set the boundary neither.

Any Clue??

Regards
Hisham
Hisham is offline   Reply With Quote

Old   October 25, 2011, 08:43
Default
  #4
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17
kathrin_kissling is on a distinguished road
Hey,

can you try to print out the boundary field directly after setting it?
Within which routine is this calculation?

Best

Kathrin
kathrin_kissling is offline   Reply With Quote

Old   October 25, 2011, 09:07
Default
  #5
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
for
Code:
forAll( alpha1.boundaryField()[myWaterWaves.patchID], facej)
{
  alpha1.boundaryField()[myWaterWaves.patchID][facej]=(1.);
}


Info << "Boundary =" <<  alpha1.boundaryField()[myWaterWaves.patchID].patchInternalField() <<endl;
I get

Code:
....
Courant Number mean: 0.0160722 max: 0.160925
Interface Courant Number mean: 0.00119692 max: 0.0651188
deltaT = 0.00437063

Calculating Water Waves!

Boundary =7(1 0.0003235 3.23137e-07 1 1.00001 2.25737e-06 0.708186)
Time = 6

MULES: Solving for alpha1
Liquid phase volume fraction = 0.509359  Min(alpha1) = -3.17553e-30  Max(alpha1) = 1.00001
......
I am trying to control the VOF value at boundary for surface wave simulations. I think it is done at boundary because it is done like so in groovyBC. Or should I try to impose it on cells next to boundary?
Hisham is offline   Reply With Quote

Old   October 25, 2011, 09:54
Default
  #6
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Hi

For some strange reason, that has to do with values of another boundaryField at the same patch, it was not behaving as expected.

Now, it is working fine as expected with the mentioned code. Thanks again!

Regards
Hisham
Hisham is offline   Reply With Quote

Reply

Tags
boundaryfield, volscalafield


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
if-loop, volScalarField comparison volker OpenFOAM 7 March 6, 2020 21:03
Cells with t below lower limit Purushothama Siemens 2 May 31, 2010 22:58
Boundary condition setting for non-premixed combustion using reactingFoam skyopener OpenFOAM 0 May 23, 2010 23:55
Ultra high temperature? bk Siemens 2 July 19, 2005 01:01
Warning 097- AB Siemens 6 November 15, 2004 05:41


All times are GMT -4. The time now is 20:55.