|
[Sponsors] |
January 26, 2018, 10:07 |
Coupling Patches
|
#1 |
New Member
Join Date: Jan 2018
Posts: 3
Rep Power: 8 |
Dear FOAMers,
i want to couple the mass flow of an outlet BC to the inlet BC, thus I modified the pressureInletVelocity BC. My problem is that the scalar outflow doesn't work and I can't use it. The code looks as follows: { if (updated()) { return; } const surfaceScalarField& rhoPhi = db().lookupObject<surfaceScalarField>("rhoPhi"); const volScalarField& rho = db().lookupObject<volScalarField>("rho"); tmp<vectorField> n = patch().nf(); const fvMesh& mesh = patch().boundaryMesh().mesh(); label couplingPatchID = mesh.boundaryMesh().findPatchID(couplingPatchName_ ); const Field<scalar>& magS = patch().magSf(); const fvPatchField<scalar>& rho_Patch = patch().lookupPatchField<volScalarField, scalar>(rhoName_); if (rhoPhi.dimensions() == dimVelocity*dimArea*dimDensity) { const fvsPatchField<scalar>& outflow = sum(rhoPhi.boundaryField()[couplingPatchID]); const scalar S_patch = sum(magS); operator==(n*outflow/S_patch); Info<< "mass flux = " <<outflow << endl <<endl; } else { FatalErrorInFunction << "dimensions of phi are not correct" << "\n on patch " << this->patch().name() << " of field " << this->internalField().name() << " in file " << this->internalField().objectPath() << exit(FatalError); } fixedValueFvPatchVectorField::updateCoeffs(); } Can anyone help me with that problem? THANK YOU IN ADVANCE |
|
January 27, 2018, 11:50 |
|
#2 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
why don't you use cyclic boundary condition ?
__________________
My Personal Website (http://nimasamkhaniani.ir/) Telegram channel (https://t.me/cfd_foam) |
|
January 29, 2018, 02:51 |
|
#3 |
New Member
Join Date: Jan 2018
Posts: 3
Rep Power: 8 |
Thank you very much nimasam for your quick answer!
I think the way I wanted to tackle the problem was too complicated |
|
January 29, 2018, 07:03 |
|
#4 |
New Member
Join Date: Jan 2018
Posts: 3
Rep Power: 8 |
But regardless of using cyclic boundary condition would be the better choice, what is the problem in my coded BC?
|
|
January 29, 2018, 22:19 |
|
#5 | |
New Member
Yuncheng Xu (Cloud)
Join Date: May 2011
Location: State College, PA
Posts: 20
Rep Power: 15 |
Quote:
First, you need to make sure couplingPatchID is correct. Second, in the following code, outflow is defined as fvsPatchField, which is not a scalar. Also, sum(rhoPhi.boundaryField() makes no sense. Code:
const fvsPatchField<scalar>& outflow = sum(rhoPhi.boundaryField()[couplingPatchID]); const scalar S_patch = sum(magS); operator==(n*outflow/S_patch); Code:
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) { const fvPatchField<scalar>& rhop = patch().lookupPatchField<volScalarField, scalar>(rhoName_); operator==(n*phip/(rhop*magS)); } |
||
Tags |
boudary field, patch field |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Foam::error::PrintStack | almir | OpenFOAM Running, Solving & CFD | 92 | May 21, 2024 08:56 |
Coupling patches in chtMultiRegionSimpleFoam | Nkl | OpenFOAM Running, Solving & CFD | 17 | May 19, 2023 10:23 |
Possible bug with stitchMesh and cyclics in OpenFoam | Jack001 | OpenFOAM Pre-Processing | 0 | May 21, 2016 09:00 |
[blockMesh] Merging edge patches | Yosmcer | OpenFOAM Meshing & Mesh Conversion | 11 | November 16, 2014 15:51 |
[swak4Foam] groovyBC for coupling of patches | deniggo | OpenFOAM Community Contributions | 20 | October 2, 2014 19:04 |