CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Changing Temperature of patch within code of solver

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 21, 2017, 11:56
Default Changing Temperature of patch within code of solver
  #1
New Member
 
A
Join Date: Feb 2017
Location: Dortmund
Posts: 2
Rep Power: 0
SalvusApfel is on a distinguished road
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.
SalvusApfel is offline   Reply With Quote

Old   February 24, 2017, 08:29
Default
  #2
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21
Zeppo will become famous soon enough
First. No need to make a redundant copy of your field
Quote:
Originally Posted by SalvusApfel View Post
Code:
const fvPatchScalarField& T_grenzflaeche = T.boundaryField()[PatchID];
fvPatchScalarField T_neu = T_grenzflaeche;
T_neu == 100; 
T.boundaryField()[PatchID] == T_neu;
This piece of code is more effective
Code:
fvPatchScalarField& T_grenzflaeche = T.boundaryFieldRef()[PatchID];
T_grenzflaeche == 100;
Second. Let us see your 0/T file
Zeppo is offline   Reply With Quote

Reply

Tags
not working, patch, solver


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 18:42.