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

Setting boundaryField for a volScalarField

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   October 24, 2011, 13:59
Default Setting boundaryField for a volScalarField
  #1
Senior Member
 
Hisham's Avatar
 
Hisham El Safti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 247
Blog Entries: 10
Rep Power: 8
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, 02:32
Default
  #2
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 8
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, 06:50
Default
  #3
Senior Member
 
Hisham's Avatar
 
Hisham El Safti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 247
Blog Entries: 10
Rep Power: 8
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, 07:43
Default
  #4
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 8
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, 08:07
Default
  #5
Senior Member
 
Hisham's Avatar
 
Hisham El Safti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 247
Blog Entries: 10
Rep Power: 8
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, 08:54
Default
  #6
Senior Member
 
Hisham's Avatar
 
Hisham El Safti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 247
Blog Entries: 10
Rep Power: 8
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

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cells with t below lower limit Purushothama CD-adapco 2 May 31, 2010 21:58
Boundary condition setting for non-premixed combustion using reactingFoam skyopener OpenFOAM 0 May 23, 2010 22:55
if-loop, volScalarField comparison volker OpenFOAM 5 April 23, 2010 14:18
Ultra high temperature? bk CD-adapco 2 July 19, 2005 00:01
Warning 097- AB CD-adapco 6 November 15, 2004 05:41


All times are GMT -4. The time now is 23:37.