|
[Sponsors] |
Changing Temperature of patch within code of solver |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
A
Join Date: Feb 2017
Location: Dortmund
Posts: 2
Rep Power: 0 ![]() |
Hello guys,
I'm new to this page and to openFOAM, so I hope this thread is in the right place ![]() My aim is to modify the temperature of a baffle within the code of the scalarTransportFoam solver. So I copied the dictionary of scalarTransportFoam and modified it to ''MYscalarTransportFoam''. In addition I inserted a piece of code, which should set every entry of the scalar field of T to the value 100. I pasted the code below. When applying wmake on the code, there's no error message or such, it even compiles normally as like the ''normal'' scalarTransportFoam would. Problem: When the case is compiled and viewed in paraFoam, the temperature of the baffle didn't change at all (I set it to 50 in the 0 dictionary). Why doesn't it change the Temperature? I would be very grateful if anyone could help me, and want to thank you in advance! EDIT: I'm using openFOAM 4.1 on Ubuntu 16.04 LTS Best regards, SalvusApfel Code of MYscalarTransportFoam.C #include "fvCFD.H" #include "fvOptions.H" #include "simpleControl.H" #include "mixedFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" simpleControl simple(mesh); #include "createFields.H" #include "createFvOptions.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nCalculating scalar transport\n" << endl; #include "CourantNo.H" while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; label PatchID = mesh.boundaryMesh().findPatchID("baffleFacesThermo Baffle1D_master"); const fvPatchScalarField& T_grenzflaeche = T.boundaryField()[PatchID]; fvPatchScalarField T_neu = T_grenzflaeche; T_neu == 100; T.boundaryField()[PatchID] == T_neu; while (simple.correctNonOrthogonal()) { fvScalarMatrix TEqn ( fvm::ddt(T) + fvm::div(phi, T) - fvm::laplacian(DT, T) == fvOptions(T) ); TEqn.relax(); fvOptions.constrain(TEqn); TEqn.solve(); fvOptions.correct(T); } runTime.write(); } Info<< "End\n" << endl; return 0; } Last edited by SalvusApfel; February 22, 2017 at 10:21. |
|
![]() |
![]() |
![]() |
![]() |
#2 | |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21 ![]() |
First. No need to make a redundant copy of your field
Quote:
Code:
fvPatchScalarField& T_grenzflaeche = T.boundaryFieldRef()[PatchID]; T_grenzflaeche == 100; |
||
![]() |
![]() |
![]() |
Tags |
not working, patch, solver |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[openSmoke] libOpenSMOKE | Tobi | OpenFOAM Community Contributions | 562 | January 25, 2023 09:21 |
[Other] Wedge patch '*' is not planar | LilumDaru | OpenFOAM Meshing & Mesh Conversion | 6 | January 12, 2021 05:55 |
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch | gschaider | OpenFOAM Installation | 225 | August 25, 2015 19:43 |
[Commercial meshers] Fluent msh and cyclic boundary | cfdengineering | OpenFOAM Meshing & Mesh Conversion | 48 | January 25, 2013 03:28 |
[blockMesh] Cyclic BC's: Possible face ordering problem? (Channel flow) | sega | OpenFOAM Meshing & Mesh Conversion | 3 | September 28, 2010 12:46 |