|
[Sponsors] |
writing the boundary information using U.write() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 6, 2014, 12:06 |
writing the boundary information using U.write()
|
#1 |
Senior Member
Join Date: Jan 2013
Posts: 372
Rep Power: 14 |
Dear All,
I used the following to write out a new variable: Code:
U_new=U; U_new.write(); Code:
wall { type calculated; value uniform (0 0 0); } Code:
wall { type fixedValue; value uniform (0 0 0); } OFFO |
|
June 6, 2014, 22:49 |
|
#2 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 15 |
Does this work?
Code:
volVectorField U_new ( IOobject( "U_new", mesh.time().timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionedVector("zero",dimensionSet(0,1,-1,0,0,0,0),Foam::vector(0,0,0) ), U.boundaryField().types() ) Code:
U_new=U; U_new.write(); |
|
June 7, 2014, 05:22 |
|
#3 |
Senior Member
Join Date: Jan 2013
Posts: 372
Rep Power: 14 |
It works well. Thank you very much!
|
|
June 7, 2014, 19:29 |
|
#4 |
Senior Member
Join Date: Jan 2013
Posts: 372
Rep Power: 14 |
Dear Adhiraj,
I found that when I use the above lines to write out the U_new, the values at the boundaries are still not correct, although the boundary type is correct now. for example: about the turbulentInlet BC: Code:
type turbulentInlet value nonuniform<List> (100e+100 100e+200 100d+200 ... ...) OFFO |
|
June 8, 2014, 06:49 |
|
#5 |
Senior Member
Join Date: Jan 2013
Posts: 372
Rep Power: 14 |
Hello,
it seems I still have some difficulty in writing out the new fields. The task is like: I have a old field, called U, and then did some treatment in the interalFields of U. I will try to write out the new internalField but old boundaryField into a new field, called U_c. The code is as follows: Code:
volVectorField U_c ( IOobject ( "U_c", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedVector ( "U_c", U.dimensions(), vector(0,0,0) ), U.boundaryField().types() ); vectorField& Ucell = U.internalField(); vectorField& U_ccell = U_c.internalField(); forAll(cellcentre,celli) { U_ccell[celli] = Ucell[celli]; //.................some operations here. } forAll(U.boundaryField(), patchi) { fvPatchVectorField& pU = U.boundaryField()[patchi]; fvPatchVectorField& pU_c = U_c.boundaryField()[patchi]; forAll(pU, facei) { pU_c[facei] = pU[facei]; } } U_c.write(); The boundary type is correct written out. However, the values on the patches are not correctly output. The values on some patches are random numbers-very small or large numbers. Could anyone tell me what I am missing in the above code? |
|
August 16, 2014, 07:49 |
|
#6 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Greetings to all!
@OFFO: Quote:
If you haven't, are you certain you're providing the complete code that you are using for manipulating "U_c"? I ask this because "U_c" is created with the option "IOobject::AUTO_WRITE", which means that at the end of an iteration, it will also write the field once again. This could mean that the "U_c" field is being altered between the time it was written with the explicit call to ".write()" and the end of the run time loop. Best regards, Bruno |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Implementation of boundary conditions for FVM | Tom | Main CFD Forum | 7 | August 26, 2014 05:58 |
Radiation interface | hinca | CFX | 15 | January 26, 2014 17:11 |
Concentric tube heat exchanger (Air-Water) | Young | CFX | 5 | October 6, 2008 23:17 |
Multicomponent fluid | Andrea | CFX | 2 | October 11, 2004 05:12 |
Boundary conditions? | Tom | Main CFD Forum | 0 | November 5, 2002 01:54 |