|
[Sponsors] |
Re-read basicPsiThermo from temperature file. |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Member
Oleg Sutyrin
Join Date: Feb 2016
Location: Russia
Posts: 41
Rep Power: 10 ![]() |
I'm developing custom solver based on rhoCentralDyMFoam for foam-extend 3.2 (which is closest to OpenFOAM v3, I believe).
Initial condition, including thermodynamics, is read from 3 files: p, T, U: Code:
autoPtr<basicPsiThermo> pThermo ( basicPsiThermo::New(mesh) ); basicPsiThermo& thermo = pThermo(); //reads p and T? volScalarField& p = thermo.p(); volScalarField& e = thermo.e(); const volScalarField& T = thermo.T(); const volScalarField& psi = thermo.psi(); const volScalarField& mu = thermo.mu(); volVectorField U //reads U ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), thermo.rho(), rhoBoundaryTypes ); In the original rhoCentralFoam, thermodynamics is updated via solving density, momentum and energy equations and using thermo.correct(): Code:
(code is simplified for reading) solve(fvm::ddt(rho) + fvc::div(phi)); solve(fvm::ddt(rhoU) + fvc::div(phiUp)); U = rhoU/rho; solve(fvm::ddt(rhoE) + fvc::div(phiEp) - fvc::div(sigmaDotU)); e = rhoE/rho - 0.5*magSqr(U); thermo.correct(); p = rho/psi; //psi is 1/(RT) Chain i'm trying to implement would be backward: (T) -> (rho). P.s. The whole thing is needed only to apply setFields to locally refined mesh AND preserve correct refinementHistory for further adaptive mesh refinement. The other way would be to manually preprocess the mesh with setSet and refineMesh, then apply setFields command-line utility. But refineMesh doesn't generate refinementHistory (thus all cells are considered of refineLevel 0 which ruins AMR later). Maybe there is a way to generate refinement history upon preprocessing and the load it into solver upon creating dynamicFvMesh? |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Member
Oleg Sutyrin
Join Date: Feb 2016
Location: Russia
Posts: 41
Rep Power: 10 ![]() |
Found a workaround that use standalone utility that reads fields (including thermo, like original rhoCentralFoam does), refines mesh once, writes mesh (including refinement history), applies setField and exits. Running this utility several times in a row results in exactly what I need as an initial state for my custom solver: refined mesh, updated field values and refinement history.
|
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Nicolas Cerulus
Join Date: Oct 2019
Location: Liverpool, United Kingdom
Posts: 4
Rep Power: 7 ![]() |
Hi Oleg,
I am currently trying to run rhoCentralDyMFoam with AMR using, like you mag(grad(rho)) as my criteria for refinement however it doesnt seem to work as, mag(grad(rho)) is not an available volScalarField. I've seen methods with creating new solvers etc but was wondering if you knew of an easier work around? thanks Nic |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Member
Oleg Sutyrin
Join Date: Feb 2016
Location: Russia
Posts: 41
Rep Power: 10 ![]() |
Hey NCerulus,
If i remember correctly, there was no easy workaround, so I had to create my custom solver. By the way, it turned out that AMR overhead computational costs were so big (in my case, at least) that using of simple fine even-sized mesh wasn't much slower that AMR mesh. (edit) Here is, i believe, the latest code of my solver, OF4 version: https://yadi.sk/d/dlOe6YqwXfUNgA |
|
![]() |
![]() |
![]() |
![]() |
#5 |
New Member
Nicolas Cerulus
Join Date: Oct 2019
Location: Liverpool, United Kingdom
Posts: 4
Rep Power: 7 ![]() |
Hi Again
thank you very much for your source files that helps a lot with my issues. i am going to try and use your solver you provide to see if it has the desired outcome. I have compiled your solver however when i try and run i get an error saying that the rhoCentralGradDyMFoamCoeffs keyword is undefined, which make sense as i have not defined it in my dynamicMeshDict, Attached: dynamicMeshDict.txt do you have an example of your dynamicMeshDict so i can understand what needs to be included? I have been using the following resource to build my dict: https://openfoamwiki.net/index.php/P...nt_Definitions and it works fine for the usual rhoCentralDyMFoam with OF-6 |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Member
Oleg Sutyrin
Join Date: Feb 2016
Location: Russia
Posts: 41
Rep Power: 10 ![]() |
No, it seems that I haven't saved these dict files... It is possible to get the idea from the source code and reimplement these coeffs, I think.
|
|
![]() |
![]() |
![]() |
![]() |
#7 |
New Member
Nicolas Cerulus
Join Date: Oct 2019
Location: Liverpool, United Kingdom
Posts: 4
Rep Power: 7 ![]() |
No problem,
I will make my way through the source code and see if i can understand it all and will send through the dict once i have it working as well. thanks so much for your help already! |
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM.org] Patches to compile OpenFOAM 2.2 on Mac OS X | gschaider | OpenFOAM Installation | 136 | October 10, 2017 18:25 |
[swak4Foam] Problem installing swak_2.x for OpenFoam-2.4.0 | towanda | OpenFOAM Community Contributions | 6 | September 5, 2015 22:03 |
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 | Seroga | OpenFOAM Community Contributions | 9 | June 12, 2015 18:18 |
"parabolicVelocity" in OpenFoam 2.1.0 ? | sawyer86 | OpenFOAM Running, Solving & CFD | 21 | February 7, 2012 12:44 |