|
[Sponsors] |
Trouble accessing volVectorField while decomposing |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 9, 2021, 18:51 |
Trouble accessing volVectorField while decomposing
|
#1 |
Member
Petros Ampatzidis
Join Date: Oct 2018
Location: Bath, UK
Posts: 64
Rep Power: 8 |
Hi all,
I am writing a custom boundary condition (BC) that needs to have access to a user-defined volVectorField named Uomega. The BC compiles without any error and the solver runs fine with a single processor. I should say that the BC is applied to a wall patch and the volVectorField is created properly in createFields.H. However, when I try to decompose the case for a parallel run I get the following error: Code:
--> FOAM FATAL ERROR: request for volVectorField Uomega from objectRegisrty region0 failed available objects of type volVectorField are 0() From const Type& Foam::objectRegistry::lookupObject(const Foam::word&, bool) const [with Type = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>] in file /home/pawan/OpenFOAM/OpenFOAM-v2006/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 463. FOAM aborting Code:
Foam::EvCoHFNoHNewLookUpFvPatchScalarField:: EvCoHFNoHNewLookUpFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : fixedValueFvPatchScalarField(p, iF), Lrho_(dict.get<scalar>("Lrho")), UomegaName_(dict.getOrDefault<word>("Uomega", "Uomega")) { if (dict.found("value")) { fvPatchField<scalar>::operator= ( Field<scalar>("value", dict, p.size()) ); } else { updateCoeffs(); } } Code:
const vectorField& Uomega = patch().lookupPatchField<volVectorField, vector>(UomegaName_); Petros |
|
July 11, 2021, 10:22 |
|
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
The obvious question(s) : where is the variable created? And you certain it has been created before your boundary condition uses it?
If it works in serial, that is usually an indication of some branching in your code where it is only created for Pstream :: master. |
|
July 12, 2021, 04:14 |
|
#3 |
Senior Member
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 16 |
It is looking for UmegaName vector field which is not available. Check if you can avoid calling updateCoeffs in constructor and force user to provide value to start with.
-Yogesh |
|
July 12, 2021, 06:57 |
|
#4 | |
Member
Petros Ampatzidis
Join Date: Oct 2018
Location: Bath, UK
Posts: 64
Rep Power: 8 |
Quote:
The variable Uomega is created in createFields.H before the field which the said boundary condition applies to. By using some output on the screen, it turns out that when running in serial, the variable Uomega is updated before the boundary condition but when I decompose the case the Uomega is updated after the boundary condition and hence not available. Why is this the case? Regarding your second note, how can I locate this branching in the code? What should I be looking for? Petros |
||
July 12, 2021, 07:50 |
|
#5 | |
Member
Petros Ampatzidis
Join Date: Oct 2018
Location: Bath, UK
Posts: 64
Rep Power: 8 |
Quote:
As you can see in the code there is an if statement where the user can provide an initial value. The problem here is that when I include an initial value my boundary condition doesn't write the calculated values but instead holds that initial value till the end. I am not sure why this happens either. However, when I use updateCoeffs() in the constructor everything seems to work fine. Additionally, I've seen other boundary conditions using updateCoeffs() (or evaluate(), which I have also tried with same results) in the constructor, e.g. rotatingWallVelocity. But the main question is why it works in serial but fails in the decomposition. Please also refer to my previous post for the order of update of the two fields. Petros |
||
July 22, 2021, 17:11 |
|
#6 |
Member
Petros Ampatzidis
Join Date: Oct 2018
Location: Bath, UK
Posts: 64
Rep Power: 8 |
Sorry for bringing this up again but I still can't find the answer.
The only work-around that seems to work is to decompose the case using default boundary conditions and then manually set the custom boundary condition in the processor folders. |
|
July 31, 2021, 07:43 |
|
#7 |
Member
Petros Ampatzidis
Join Date: Oct 2018
Location: Bath, UK
Posts: 64
Rep Power: 8 |
Problem solved with the valuable help of a fellow foamer.
For future reference: 1. I removed updateCoeffs() from the constructor. 2. Added <myField>.correctBoundaryConditions() at the end of the solver iteration as my fields where not used in any fvm:: operations and thus weren't updated automatically at every time step. Petros |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
request fo volVectorField U.particles from objectRegistry regin0 failed-TwoPhaseEuler | Hamed1117 | OpenFOAM Programming & Development | 5 | May 24, 2023 09:13 |
Accessing a vector in a volVectorField by cell label | andrewryan | OpenFOAM Programming & Development | 7 | June 8, 2018 05:48 |
[swak4Foam] Trouble accessing fields within expressionField | aerogt3 | OpenFOAM Post-Processing | 6 | May 12, 2017 16:02 |
accessing to parameters of a volVectorField | sasookey | OpenFOAM Programming & Development | 1 | May 13, 2012 15:33 |
Why does accessing a zeroGradient patch return (0 0 0) for a volVectorField | l_r_mcglashan | OpenFOAM | 0 | August 20, 2010 14:27 |