|
[Sponsors] |
October 24, 2011, 14:59 |
Setting boundaryField for a volScalarField
|
#1 |
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
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.); } 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 Regards, Hisham |
|
October 25, 2011, 03:32 |
|
#2 |
Senior Member
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17 |
Hi,
can you just try to skip ".operator" Code:
forAll( alpha1.boundaryField()[myWaterWaves.patchID], facei) { alpha1.boundaryField()[myWaterWaves.patchID][facei]=(1.); } Best Kathrin |
|
October 25, 2011, 07:50 |
|
#3 |
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
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 |
|
October 25, 2011, 08:43 |
|
#4 |
Senior Member
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17 |
Hey,
can you try to print out the boundary field directly after setting it? Within which routine is this calculation? Best Kathrin |
|
October 25, 2011, 09:07 |
|
#5 |
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
for
Code:
forAll( alpha1.boundaryField()[myWaterWaves.patchID], facej) { alpha1.boundaryField()[myWaterWaves.patchID][facej]=(1.); } Info << "Boundary =" << alpha1.boundaryField()[myWaterWaves.patchID].patchInternalField() <<endl; 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 ...... |
|
October 25, 2011, 09:54 |
|
#6 |
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
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 |
|
Tags |
boundaryfield, volscalafield |
|
|
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 |