|
[Sponsors] |
How to write specific term in openfoam solver |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 27, 2020, 00:54 |
How to write specific term in openfoam solver
|
#1 |
New Member
Divyesh Variya
Join Date: May 2018
Location: INDIA
Posts: 16
Rep Power: 8 |
Hello Foamers,
I am trying to modify the laplacian foam. Here is the code for equation, volScalarField U(a+(b*T)+(c*T*T)); fvScalarMatrix TEqn ( fvm::ddt(T) - fvm::laplacian(U,T) - (k) == fvOptions(T) ); fvOptions.constrain(TEqn); TEqn.solve(); fvOptions.correct(T); } Where, a,b,c & k are constants. Now, I want to write the value of "U" for each time step. How can I do that? Thanks in advance |
|
January 27, 2020, 01:05 |
|
#2 |
Senior Member
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 16 |
You can create volScalar field using IOObject and use AUTO_WRITE option for it. It will write at every save option. If you want to write every time step you can use write function after end of each time step. Then it will write every time step.
|
|
January 27, 2020, 01:11 |
|
#3 |
New Member
Divyesh Variya
Join Date: May 2018
Location: INDIA
Posts: 16
Rep Power: 8 |
if (runTime.writeTime())
{ volScalarField U(a+(b*T)+(c*T*T)); ( IOobject ( "U", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), U ); runTime.write(); } I tried this one, but its not working. Solver is compiling, case is running but it is not writing "U" file. |
|
January 27, 2020, 06:08 |
|
#4 | |
Member
Vivek
Join Date: Mar 2018
Location: India
Posts: 54
Rep Power: 8 |
Quote:
PHP Code:
2. Now use your expression inside your solver PHP Code:
Best, Vivek S |
||
January 27, 2020, 07:19 |
|
#5 |
New Member
Divyesh Variya
Join Date: May 2018
Location: INDIA
Posts: 16
Rep Power: 8 |
Thanks, Now its writing U for each time step.
I just change dimensions with this: dimensionSet(0,2,-1,0,0,0,0), But issue is, It is taking default value of time 0 uniform value. While running the case, Value of T is non-uniform and value of U is uniform. Any idean what is the mistake? |
|
January 27, 2020, 08:23 |
|
#6 |
Member
Vivek
Join Date: Mar 2018
Location: India
Posts: 54
Rep Power: 8 |
Are you specifying BC's of U in 0 time folder?
If not , then your values of U should be non-uniform in internalField & calculated values at Boundary patches. |
|
January 28, 2020, 00:56 |
|
#7 |
New Member
Divyesh Variya
Join Date: May 2018
Location: INDIA
Posts: 16
Rep Power: 8 |
No, I am not specifying BC for U in my time 0 folder.
Look at the calculated value for U in all next time steps... internalField uniform 77.359; boundaryField { Side1 { type zeroGradient; } Side2 { type zeroGradient; } walls { type empty; } } But my T is changing non-uniformally... like this internalField nonuniform List<scalar> 50 ( 571.591 559.42 547.284 535.214 523.241 511.396 499.706 488.2 476.904 465.844 455.041 444.518 434.293 424.384 414.806 405.571 396.691 388.173 380.024 372.248 364.847 357.82 351.166 344.881 338.959 333.393 328.175 323.294 318.741 314.503 310.566 306.918 303.545 300.431 297.563 294.923 292.498 290.271 288.228 286.352 284.628 283.041 281.576 280.219 278.953 277.765 276.641 275.566 274.525 273.506 ) ; boundaryField { Side1 { type fixedValue; value uniform 573; } Side2 { type fixedValue; value uniform 273; } walls { type empty; } } |
|
January 28, 2020, 01:55 |
|
#8 |
Member
Vivek
Join Date: Mar 2018
Location: India
Posts: 54
Rep Power: 8 |
I think you have called U variable outside of your time loop if I am correct
Put it inside the time loop |
|
January 28, 2020, 05:07 |
|
#9 |
New Member
Divyesh Variya
Join Date: May 2018
Location: INDIA
Posts: 16
Rep Power: 8 |
Thanks Vivek,
Its working. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Map of the OpenFOAM Forum - Understanding where to post your questions! | wyldckat | OpenFOAM | 10 | September 2, 2021 06:29 |
[ANSYS Meshing] Help with element size | sandri_92 | ANSYS Meshing & Geometry | 14 | November 14, 2018 08:54 |
Domain Reference Pressure and mass flow inlet boundary | AdidaKK | CFX | 75 | August 20, 2018 06:37 |
How to add this term to openfoam solver | rapierrz | OpenFOAM Programming & Development | 10 | February 28, 2015 13:30 |
Can't get data from OpenFoam to external solver using externalCoupled | perry | OpenFOAM Running, Solving & CFD | 4 | May 26, 2014 09:09 |