|
[Sponsors] |
write fields in openfoam database in boundary patch |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 2, 2016, 09:46 |
write fields in openfoam database in boundary patch
|
#1 |
New Member
Join Date: Mar 2016
Location: Germany
Posts: 8
Rep Power: 10 |
Hi all,
I am trying to implement a new boundary condition that reads Internal fields U, P, and temperature from external solver and write these fields from OpenFOAM in a file for external solver. to this end, i use the "externalCoupledMixedFvPatchField" boundary patch and i edit it. i try the following code to write data in OpenFOAM fields: Code:
const volScalarField& Pressure= this->db().objectRegistry::lookupObject<volScalarField>("p"); const volVectorField& Velocity= this->db().objectRegistry::lookupObject<volVectorField>("U"); const volScalarField& Temperature= this->db().objectRegistry::lookupObject<volScalarField>("T"); forAll(this->patch(), facei) { // define mesh on patch const fvMesh& mesh = this->patch().boundaryMesh().mesh(); // cell related to current face label celli =this->patch().faceCells()[facei]; // define opposite face to patch face// label oppfacei =mesh.cells()[celli].opposingFaceLabel (facei+this->patch().patch().start(),mesh.faces()); // define neighbour cell centre cellCentreN vector cellCentreN = mesh.cellCentres()[mesh.owner()[oppfacei]]; // define patch cell centre cellCentre0 vector cellCentreO = mesh.cellCentres()[mesh.neighbour()[oppfacei]]; // cell lable of cell label CellP =mesh.findCell(cellCentreO); Pressure.internalField()[CellP] = "new value"; } has anyone the idea, how i can change internal fields U,P and T within a boundary patch? Thank you iman |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
sliding mesh problem in CFX | Saima | CFX | 46 | September 11, 2021 07:38 |
Wind turbine simulation | Saturn | CFX | 58 | July 3, 2020 01:13 |
an odd(at least for me!) reconstructPar error on a field | immortality | OpenFOAM Running, Solving & CFD | 3 | June 3, 2013 22:36 |
[blockMesh] Cyclic BC's: Possible face ordering problem? (Channel flow) | sega | OpenFOAM Meshing & Mesh Conversion | 3 | September 28, 2010 12:46 |
RPM in Wind Turbine | Pankaj | CFX | 9 | November 23, 2009 04:05 |