|
[Sponsors] |
Writing/output of simple data into an ASCII-File |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 3, 2016, 19:27 |
|
#21 |
New Member
Join Date: Jul 2014
Posts: 26
Rep Power: 12 |
Hello,
What I'd like to do is something a bit different. I am implementing a new BC which is used by a certain volScalarField A. This newBC calculates the values on the same patch of another volScalarField named B. The B field is recalled inside the BC as Code:
volScalarField B = this->db().lookupObject<volScalarField>("B"); fvPatchScalarField Bs = B.boundaryField()[patchIndex]; Code:
forAll (something, j) { Bs[j]= .....bla bla bla } Code:
volScalarField A ( IOobject ( "A", runTime.timeName(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::AUTO_WRITE ), mesh, dimensionedScalar("A",dimensionSet(1, 2, -3, 0, 0, -1, 0),0) ); Code:
void Foam::newBC::write(Ostream& os) const Code:
writeEntry("Bs", os); Shall I have to code a different BC for B? If so how do I store those Bs value from my newBC of A? (because write now as soon as I get out of the newBC they are removed) Any ideas? (sorry for being messy) Thx |
|
May 4, 2016, 03:58 |
|
#22 |
Member
Vignesh
Join Date: Oct 2012
Location: Darmstadt, Germany
Posts: 66
Rep Power: 14 |
Hi Minisasi,
Can you try something like this ? Code:
if (dimensionedInternalField().mesh().time().outputTime()) { B.write(); }
__________________
Thanks and Regards Vignesh |
|
May 4, 2016, 11:42 |
|
#23 |
New Member
Join Date: Jul 2014
Posts: 26
Rep Power: 12 |
Hi,
Thank you for your reply, but unfortunately it didn't work. I tried to follow what they previously wrote couple of posts ago, and I wrote inside my newBC (for A) Code:
fileName testFile("TEST.txt"); OFstream os(db().time().constant()/testFile); os << "This is the first line in the file.\n"; os << B.boundaryField()[patchIndex].size(); os << endl forAll (something, j) { Bs[j]...... bla bla bla; os<< Bs[j]; os << endl; } Any hints? |
|
August 19, 2017, 18:00 |
increasing writing precision
|
#24 |
Member
|
Dear Former,
In my OpenFOAM code, I defined a variable to trace my flame front position. So, in my log file the x position of that variable will be reported (component (0)). It works fine, but my problem is I can not increase the writing precision of this value! For example, in my running log file, I have Time = 0.000000240, max flametip = 71.9713, but I want my flametip have more accuracy! I will apperaciate any suggestion and help. To bear in mind, in my control dict, I put writePrecision 9; , timePrecision 9; and writeFormat ascii; Best Regards, Reza |
|
January 8, 2019, 14:28 |
|
#25 |
Senior Member
Join Date: Sep 2013
Posts: 353
Rep Power: 21 |
...........................
|
|
Tags |
output data, output to file, write data, write to file |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Installation of OpenFOAM-1.6 on Ubuntu 9.10 | marval | OpenFOAM Installation | 2 | March 17, 2010 09:33 |
Problem installing on Ubuntu 9.10 -> 'Cannot open : No such file or directory' | mfiandor | OpenFOAM Installation | 2 | January 25, 2010 10:50 |
[OpenFOAM] ParaView 33 canbt open OpenFoam file | hariya03 | ParaView | 7 | September 25, 2008 18:33 |
[OpenFOAM] Paraview command not found | hardy | ParaView | 7 | September 18, 2008 05:59 |
DecomposePar links against liblamso0 with OpenMPI | jens_klostermann | OpenFOAM Bugs | 11 | June 28, 2007 18:51 |