|
[Sponsors] |
Changing Temperature of patch within code of solver |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 21, 2017, 11:56 |
Changing Temperature of patch within code of solver
|
#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 11:21. |
|
February 24, 2017, 08:29 |
|
#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 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] Wedge patch '*' is not planar | LilumDaru | OpenFOAM Meshing & Mesh Conversion | 7 | September 18, 2024 06:52 |
[openSmoke] libOpenSMOKE | Tobi | OpenFOAM Community Contributions | 562 | January 25, 2023 10:21 |
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch | gschaider | OpenFOAM Installation | 225 | August 25, 2015 20:43 |
[Commercial meshers] Fluent msh and cyclic boundary | cfdengineering | OpenFOAM Meshing & Mesh Conversion | 48 | January 25, 2013 04:28 |
[blockMesh] Cyclic BC's: Possible face ordering problem? (Channel flow) | sega | OpenFOAM Meshing & Mesh Conversion | 3 | September 28, 2010 13:46 |