|
[Sponsors] |
How to add the values of any volscalarfield variable in every timestep |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 22, 2020, 13:21 |
How to add the values of any volscalarfield variable in every timestep
|
#1 |
New Member
Pratik
Join Date: May 2020
Location: Oldenburg, Germany
Posts: 14
Rep Power: 5 |
I am quite new to OpenFOAM and I would like to know if there is anything we can do in code to fetch the values of volscalarfield variable in all the time steps as it happens with the other filed values like k Omega etc. I tried Info statement but that method prints the values on screen but I would like to have it in timesteps so that I can see them in paraview.
|
|
December 23, 2020, 06:03 |
|
#2 |
Senior Member
|
The likelihood that I am only partially understanding the question you raise is high.
Let me try to give an answer despite of this. Typically additional volScalarFields are defined in createFields.H. By setting appropriate write attributes, the volScalarField is written to file at every time step. |
|
December 23, 2020, 21:31 |
|
#3 |
New Member
Pratik
Join Date: May 2020
Location: Oldenburg, Germany
Posts: 14
Rep Power: 5 |
Yeh, you understood my questions correctly.I am trying to change createfields.H file of my solver but I am not able to compile it successfully. I tried some of the methods earlier posted on the forum. Do you know any method to compile the modified code successfully?
|
|
December 24, 2020, 12:48 |
|
#4 |
Senior Member
|
Again, not sure what information you already have and what is missing.
Typically, however, solvers are compiled using the wmake (shell around make) guided by the Make/files and Make/options files. It suffices to look how standard solvers are compiled. |
|
December 24, 2020, 12:56 |
|
#5 |
New Member
Pratik
Join Date: May 2020
Location: Oldenburg, Germany
Posts: 14
Rep Power: 5 |
Hello,
I managed to compile the code but I have another problem now I get the file of the newly added field in the time steps folder but don't get the values in the timestep folders. It just shows the values that I mentioned in the 0 folder. for curiosity, I used Info statement to print the values of the newly added field on-screen, and there it shows the expected values. but then why I am not getting them in timestep folders? compile the cod but |
|
December 24, 2020, 14:09 |
|
#7 |
New Member
Pratik
Join Date: May 2020
Location: Oldenburg, Germany
Posts: 14
Rep Power: 5 |
Info<< "Reading field p\n" << endl;
volScalarField p ( IOobject ( "p", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field U\n" << endl; volVectorField U ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); volScalarField gammabc ( IOobject ( "gammabc", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh (I have also tried adding dimensions here) ); #include "createPhi.H" label pRefCell = 0; scalar pRefValue = 0.0; setRefCell(p, simple.dict(), pRefCell, pRefValue); mesh.setFluxRequired(p.name()); singlePhaseTransportModel laminarTransport(U, phi); autoPtr<incompressible::turbulenceModel> turbulence ( incompressible::turbulenceModel::New(U, phi, laminarTransport) ); #include "createMRF.H" #include "createFvOptions.H" This is my createFields.H file |
|
December 24, 2020, 14:20 |
|
#9 |
New Member
Pratik
Join Date: May 2020
Location: Oldenburg, Germany
Posts: 14
Rep Power: 5 |
Yes fields are getting written but the newly defined field is not getting written as expected.
But my log file shows the expected values of new field gammabc You can see the part of my log file below Starting time loop wallShearStress wallShearStress: processing all wall patches Reading set description: line Time = 1 smoothSolver: Solving for Ux, Initial residual = 1, Final residual = 0.0929271, No Iterations 6 smoothSolver: Solving for Uy, Initial residual = 1, Final residual = 0.0846516, No Iterations 2 GAMG: Solving for p, Initial residual = 1, Final residual = 0.0981968, No Iterations 28 time step continuity errors : sum local = 0.000144915, global = -3.05636e-06, cumulative = -3.05636e-06 gammabcdimensions [0 0 0 0 0 0 0]; internalField nonuniform List<scalar> 26820 ( 0 0 0 0 0 0 0 0 0 |
|
December 24, 2020, 14:22 |
|
#10 |
New Member
Pratik
Join Date: May 2020
Location: Oldenburg, Germany
Posts: 14
Rep Power: 5 |
and this is how I have defined gammabc in the model
template<class BasicTurbulenceModel> tmp<volScalarField> SABC<BasicTurbulenceModel>::gammabc ( const volScalarField& Term1, const volScalarField& Term2, const volScalarField& nubc, const volScalarField& Rev, const volScalarField& ReTheta ) const { return ( 1 - exp(-sqrt(Term1)-sqrt(Term2)) ); } |
|
December 24, 2020, 14:55 |
|
#12 |
New Member
Pratik
Join Date: May 2020
Location: Oldenburg, Germany
Posts: 14
Rep Power: 5 |
I can try this.
But one question. Do we need to make any changes in the .C file of the solver (simpleFoam.C) after adding new fields in createFields.H file? |
|
December 24, 2020, 15:57 |
|
#13 |
Senior Member
|
Nope, or better.
You should see that createFields.H is included in simpleFoam.C. This means that after every change in createFields.C, the file simpleFoam.C should be re-compiled. The dependency list in the makefile system should take of that. Else you can you the unix touch utility to force the recompilation of the simpleFoam.C file |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Creating variable including results from earlier timestep | gcoopermax | CFX | 0 | May 31, 2017 04:53 |
using chemkin | JMDag2004 | OpenFOAM Pre-Processing | 2 | March 8, 2016 22:38 |
Reference Values for Troughs @ variable Angle? | hornig | FLUENT | 1 | April 12, 2014 22:26 |
Add values of points from two different files with paraview | nunoloureiro | OpenFOAM | 0 | May 5, 2010 03:30 |
Env variable not set | gruber2 | OpenFOAM Installation | 5 | December 30, 2005 04:27 |