|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
Jagan Mohan
Join Date: Dec 2019
Location: New York
Posts: 27
Rep Power: 7 ![]() |
Hello Friends, lets say we have an OpenFOAM setup which is working, converging and producing results. I'm interested in writing out each term of the governing equation as fields, either during run time or after run. That is, lets say, I'm solving ddt(T) - laplacian(gama, T).
1. How to get ddt(T) field for each timestep written out into time folders at all control volume centroids? Ideally, this should go to zero as time proceeds. 2. Also, how to write out laplacian(gama, T) field? I will try to extend it to other equation terms in in-compressible flow. Thank you, Jagan Mohan. |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
Anup Singh
Join Date: Mar 2020
Posts: 22
Rep Power: 7 ![]() |
You can simply store them in a variable and then as your wish you can either print them out or store it in a file for later use.
|
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Jagan Mohan
Join Date: Dec 2019
Location: New York
Posts: 27
Rep Power: 7 ![]() |
Hello Anup, thanks for your reply. Could you elaborate on any one of the terms as an example?
Thank you, Jagan Mohan. |
|
![]() |
![]() |
![]() |
![]() |
#4 |
New Member
Anup Singh
Join Date: Mar 2020
Posts: 22
Rep Power: 7 ![]() |
first you can declare a new variable as
volVectorField Tlap or volScalarField Tlap - depending on your field type ( IOobject ( "Tlap", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh ); and then update it as Tlap = laplacian(gama, T); This will in the end automatically write the file upon encountering runTime.write(); command. There are several other formats which you can use in one way or other. You can find about different ways for writing the data in the other threads in the fourum. |
|
![]() |
![]() |
![]() |
![]() |
#5 |
New Member
Jagan Mohan
Join Date: Dec 2019
Location: New York
Posts: 27
Rep Power: 7 ![]() |
Hello Anup, thank you for your reply.
This method works. One problem is we are forced to create text files in 0/ directory for each of the term in the governing equation. For example, here, I have to create Tlap text file similar to T text file. 1. Is there a way where we can circumvent this and still create a field variable inside the solver? Thank you, Jagan Mohan. |
|
![]() |
![]() |
![]() |
![]() |
#6 |
New Member
Anup Singh
Join Date: Mar 2020
Posts: 22
Rep Power: 7 ![]() |
As mentioned you can use different formats..
You can simply initialize your variable when you are creating it.. This eliminates the need read a file in 0 directory as all the conditions are defined as per calculation performed during initialization. For example in your case.. volVectorField Tlap or volScalarField Tlap - depending on your field type ( IOobject ( "Tlap", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), laplacian(gama, T) ); |
|
![]() |
![]() |
![]() |
![]() |
#7 |
New Member
Jagan Mohan
Join Date: Dec 2019
Location: New York
Posts: 27
Rep Power: 7 ![]() |
Hello Anup, thank you for the quick reply. Perhaps, we have to initialize as fvc::laplacian(gama, T) as the object class is volScalarField and fvc:: returns a geometricField class object.
I tried with fvc::, the code compiles and runs. I'd post-process the results. Ideally, the field should approach zero as iterations progress as I'm solving a steady-state conduction equation. Thank you, Jagan Mohan. |
|
![]() |
![]() |
![]() |
![]() |
#8 |
New Member
Jagan Mohan
Join Date: Dec 2019
Location: New York
Posts: 27
Rep Power: 7 ![]() |
I tested with fvc::laplacian(gama, T) as initialization to volScalarField variable. It works and field approaches to zero for all the interior cells (but not on the boundary cells, needs further understanding. This value is exceptional high at the corner cells).
Now how to intialize a volVectorField, say velocity of (1i + 1j + 0k) at all the cell centres? Thank you, Jagan Mohan. |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
modify pimpleFoam to write sampled fields on a patch each runtime | moh-farmani | OpenFOAM Programming & Development | 0 | August 19, 2017 15:17 |
[mesh manipulation] Importing Multiple Meshes | thomasnwalshiii | OpenFOAM Meshing & Mesh Conversion | 18 | December 19, 2015 18:57 |
several fields modified by single boundary condition | schröder | OpenFOAM Programming & Development | 3 | April 21, 2015 05:09 |
write nut fields in simpleFoam | maurice | OpenFOAM Running, Solving & CFD | 5 | March 23, 2009 01:57 |