|
[Sponsors] |
mixedBoundary not writting the correct refGrad values when executed in parallel |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 21, 2021, 19:25 |
mixedBoundary not writting the correct refGrad values when executed in parallel
|
#1 |
New Member
Join Date: Dec 2021
Posts: 23
Rep Power: 4 |
Hello to all,
I am new to OF programming, I am using OF2106, and I am trying to build a new mixed boundary condition. As an example, I have: Code:
#ifndef trash_H #define trash_H #include "mixedFvPatchField.H" #include "volFields.H" #include "surfaceFields.H" #include "PatchFunction1.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ Class trash Declaration \*---------------------------------------------------------------------------*/ class trash : public mixedFvPatchField<scalar> { // Private Data public: //- Runtime type information TypeName("trash"); // Constructors //- Construct from patch and internal field trash ( const fvPatch&, const DimensionedField<scalar, volMesh>& ); //- Construct from patch, internal field and dictionary trash ( const fvPatch&, const DimensionedField<scalar, volMesh>&, const dictionary& ); //- Construct by mapping given //- trash //- onto a new patch trash ( const trash&, const fvPatch&, const DimensionedField<scalar, volMesh>&, const fvPatchFieldMapper& ); //- Construct as copy trash ( const trash& ); //- Construct and return a clone virtual tmp<fvPatchField<scalar>> clone() const { return tmp<fvPatchField<scalar>> ( new trash(*this) ); } //- Construct as copy setting internal field reference trash ( const trash&, const DimensionedField<scalar, volMesh>& ); //- Construct and return a clone setting internal field reference virtual tmp<fvPatchField<scalar>> clone ( const DimensionedField<scalar, volMesh>& iF ) const { return tmp<fvPatchField<scalar>> ( new trash ( *this, iF ) ); } // Evaluation //- Update the coefficients associated with the patch field virtual void updateCoeffs(); //- Write virtual void write(Ostream&) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif Code:
#include "trash.H" #include "addToRunTimeSelectionTable.H" #include "fvPatchFieldMapper.H" #include "gravityMeshObject.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::trash::trash ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF ) : mixedFvPatchField<scalar>(p, iF) { refValue() = 0.0; refGrad() = 0.0; valueFraction() = 0.0; } Foam::trash::trash ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : mixedFvPatchField<scalar>(p, iF) { refValue() = 0.0; refGrad() = 0.0; valueFraction() = 0.0; if (dict.found("value")) { fvPatchField<scalar>::operator= ( Field<scalar>("value", dict, p.size()) ); } else { fvPatchField<scalar>::operator=(refValue()); } } Foam::trash::trash ( const trash& ptf, const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const fvPatchFieldMapper& mapper ) : mixedFvPatchField<scalar>(ptf, p, iF, mapper) {} Foam::trash::trash ( const trash& tppsf ) : mixedFvPatchField<scalar>(tppsf) {} Foam::trash::trash ( const trash& tppsf, const DimensionedField<scalar, volMesh>& iF ) : mixedFvPatchField<scalar>(tppsf, iF) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::trash::updateCoeffs() { if (updated()) { return; } this->refGrad() = 2; this->valueFraction() = scalar(0); this->refValue() = scalar(0); Info << "New boundary" << endl; mixedFvPatchField<scalar>::updateCoeffs(); } void Foam::trash::write ( Ostream& os ) const { mixedFvPatchField<scalar>::write(os); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { makePatchTypeField ( fvPatchScalarField, trash ); } Can anyone reproduce this? Thanks! Last edited by MamboJambo; December 24, 2021 at 10:28. |
|
December 27, 2021, 17:19 |
|
#2 |
New Member
Join Date: Dec 2021
Posts: 23
Rep Power: 4 |
Can anyone give me a hand with this? Why is not writing the values correctly? If i use OF9 just to run reconstructPar, it will reconstruct correctly ...
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
why I cannot get the correct x and y values when using UDF? | hotin87 | Fluent UDF and Scheme Programming | 14 | January 24, 2015 14:42 |
CFD-Post: How to get the correct values | ¥yy | CFX | 1 | September 19, 2014 06:09 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 06:20 |
Correct way to program a nonlinear cycle to run it in parallel | davide_c | OpenFOAM Programming & Development | 4 | March 27, 2012 09:24 |
Correct values of drag but high values of lift. | aamer | Main CFD Forum | 16 | December 16, 2010 04:44 |