|
[Sponsors] |
Editing chtMultiRegionFoam to not solve velocity field |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 6, 2011, 08:29 |
Editing chtMultiRegionFoam to not solve velocity field
|
#1 |
Senior Member
Join Date: Mar 2011
Posts: 158
Rep Power: 15 |
Hi,
I'm using the chtMulti-solvers. Finally I want to use chtMultiRegionRadFoam. But the chtMulti-solvers are very simillar, thus I'm using chtMultiRegionSimpleFoam at the moment, because I didn't get started chtMultiRegionFoam and chtMultiRegionRadFoam yet. I want to model a heat transfer with a "frozen" velocity field. In my case I can define the velocity field as steady state. The heat transfer shall be solved transient. To reduce solving-time I think about editing the solver to solve only the energy equation and not the velocity equation. Does someone know if this is possible in general, or does someone has done that before? So I thought about the time the machine needs to solve the case. Does someone know if it is also possible to switch off the solving of the velocity field? (Another question: Does someone know if it is possible to solve incompressible insteat of compressible? Maybe just by switching the density variation to zero? But where do I change that?) Best Regards, tH3f0rC3 |
|
April 7, 2011, 05:31 |
|
#2 |
Senior Member
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20 |
Import the U-Filed with the
"NO_WRITE"-Option and comment out every u/p-related #include in the solver. |
|
April 7, 2011, 09:14 |
|
#3 |
Senior Member
Join Date: Mar 2011
Posts: 158
Rep Power: 15 |
||
April 7, 2011, 18:23 |
|
#4 |
Member
Sebastian Lang
Join Date: Aug 2009
Posts: 47
Rep Power: 17 |
Hi tH3f0rC3,
these aren't actually settings you can switch on or off anywhere. You will have to edit the sourcecodes of the solver you want to modify. I gave somebody else a short introduction on how to create a customized solver that is based on some standard solver of openfoam. Have a look at this thread: http://www.cfd-online.com/Forums/ope...-function.html The interesting part for you starts with post number 5. At the moment I don't really know how to help you contentwise with your problem, but the thread mentioned above will help you with the general procedure of customizing any of openfoams executables. Maybe neewbie is able to help you contentwise. It seems as if he knows about the codes. Good luck! Greetings Sebastian |
|
April 11, 2011, 09:08 |
|
#5 |
Senior Member
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20 |
hi,
Sebastian is right about the steps. You need to do some changing in the source-code. The NO_write option in the u-field is what it says: no writing means not changing the initial velocity-field, thatīs what i thought about making it "frozen". and since you donīt need to do fvm-clalc. to solve for "u" you can delete/comment the appropriate lines in the solver source code. Just add an "//" at the beginning of the line. This is for the speed up. If you feel like adding some "user-friendlieness" you can add a dictionary-line to the source code and ask for an entry "solve vel." Code:
IOdictionary solveFor ( IOobject ( "solveFor", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); Code:
bool solveVel = false; if (solveFor.found("solveVel")) { solveVel = Switch(solveFor.lookup("solveVel")); } Code:
if(solveVel){ ... } Code:
solveVel true; But you can do the same also for an existing dictionary in the cht-solver. Check the "../fluid/readFluidMultiRegionSIMPLEControls.H" neewbie |
|
April 17, 2011, 09:48 |
|
#6 |
Senior Member
Join Date: Mar 2011
Posts: 158
Rep Power: 15 |
Hey neewbiw,
many thanks to your suggestion. I will try as soon as possible! Do you think it is necessary to first copy the solver with a new name to not making a change in the original solver source code? Did you do some source code changing in the original solvers before? I'm a little bit scared of editing in the original source code of a solver. I don't want to destroy the function of an original solver. Best Regards, tH3f0rC3 |
|
April 17, 2011, 13:43 |
|
#7 |
Member
Sebastian Lang
Join Date: Aug 2009
Posts: 47
Rep Power: 17 |
Hi tH3f0rC3,
did you not read my post? If you take a look at my post above you will find a link to a thread were I gave somebody a step by step description on how to make a copy of an original solver and how to edit it afterwards. You should not work inside the original folders! If you compile anything there, the original executable file will be replaced with your modified one and the original solver will therefore not be available anymore. You should always work on copy! Take a look at my link above, because OpenFOAM offers a very comfortable way of using customized functions. Greetings Sebastian |
|
April 17, 2011, 14:02 |
|
#8 | |
Senior Member
Join Date: Mar 2011
Posts: 158
Rep Power: 15 |
Hey Sebastian,
I have read your post, but not that detailed. I'm sorry for that! I still have tried to copy a solver before, but it hasn't worked. That depends on the installation of OF which was made on my computer. I will have to solve this problem first. But that was the reason for my question, if it is relly necessary to copy a solver. But your argument is cogent. Best Regards, tH3f0rC3 Quote:
|
||
April 18, 2011, 05:29 |
|
#9 | |
Senior Member
Join Date: Mar 2011
Posts: 158
Rep Power: 15 |
Hi,
I have now copied the solver and now want to make a change in the source code. I'm afraid I don't can find the dictionary named solveFor. Or where are the codes copied from? From which file in which directory? Best Regards, tH3f0rC3 Quote:
|
||
April 18, 2011, 05:55 |
|
#10 |
Senior Member
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20 |
thatīs totally normal. you have to create that dictionary like every other dictionary e.g. thermoPhysicalProperties, RASProperties. Take the following as the top of the new file.
Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM Extend Project: Open Source CFD | | \\ / O peration | Version: 1.6-ext | | \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object solveFor; //instead of transportProperties } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solveVel true; // ******************************************************* // Code:
IOdictionary solveFor //name ( IOobject ( "solveFor", //internalName in OF C++ Environment runTime.constant(),//where to search for mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) );
Hopefully thatīs not totally rubbish in terms of C++-speech. Please feel free to correct if not right. neewbie |
|
April 18, 2011, 15:41 |
|
#11 | ||
Senior Member
Join Date: Mar 2011
Posts: 158
Rep Power: 15 |
Ok, I ave understood to create a file named solvefor.
But I miss the change in source code. So what do I have to change in the source code? I think I have to edit the choosen file name "solveFor" somewhere in the source code. You wrote: Quote:
I also didn't get you at this point: Quote:
Are all the codes you pasted here for the solveFor-file? Best Regards, tH3f0rC3 |
|||
April 19, 2011, 08:29 |
|
#12 |
Senior Member
Join Date: Mar 2011
Posts: 158
Rep Power: 15 |
what I have found in the createFluidFields.H - file in /fluid/ is the following:
Info<< " Adding to UFluid\n" << endl; UFluid.set ( i, new volVectorField ( IOobject ( "U", runTime.timeName(), fluidRegions[i], IOobject::MUST_READ, IOobject::NO_WRITE //this is what I have changed ), fluidRegions[i] ) ); I don't even understand the necessarity of the solveFor-file. Maybe you can give me a more detailed description of what I have to do to not let the solver calculate the velocity field to speed up. Best Regards, tH3f0rC3 |
|
April 19, 2011, 10:55 |
|
#13 |
Senior Member
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20 |
hi,
the "solveFor" was just an easy way to enable/disable the solving of U. You actually donīt need it. Just forget about it. I would guess that since you have chosen NO_WRITE for the U-field, thatīs it. You have frozen the U-field. No writing. And since U is not changing there is no need for iterating and i think the solver detects this. You can set the iterations to, lets say 0 by setting the tolerance to 10 and youīre done. To disable the solving itself for the speedup just comment out the part in the solver which contains the solving for U. If you donīt solve for U, you donīt need any of the flow related calculations. in the solver C-file try Code:
... // #include "solveFluid.H" .... The real task is set in UEqn.H Code:
eqnResidual=solve ( ... ).initialResidual() There could be some errors about missing fields for turbulence, thermophysicalProp.and residuals and so one. You have to decide whether you need them or not. neewbie |
|
April 20, 2011, 10:14 |
|
#14 |
Senior Member
Join Date: Mar 2011
Posts: 158
Rep Power: 15 |
It's kind of weird.
I have changed something in the source code and wanted to see what happens. When I have regenerated the former status, before the change, the solver still does the same. I have now even re-changed my test-solver into chtMultiRegionSimpleFoam. But the solver doesn't work like it. The new solver still works like the changed one. I have started a new terminal, restarted OF and even wmake-ed the solver. Does someone have a clue? Best Regards, Dirk |
|
April 20, 2011, 10:18 |
|
#15 |
Senior Member
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20 |
Did you change the "files"-file EXE statement to point to FOAM_USER_APPBIN ? And also gave it a new name?
|
|
April 20, 2011, 10:40 |
|
#16 | |
Senior Member
Join Date: Mar 2011
Posts: 158
Rep Power: 15 |
Quote:
derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C chtMultiRegionSimpleFoam_novelocity.C EXE = $(FOAM_USER_APPBIN)/chtMultiRegionSimpleFoam_novelocity Do I have to wmake the solver after changing something in the source code? |
||
April 20, 2011, 11:53 |
|
#17 |
Senior Member
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20 |
yes. Type wmake within the source-folder and type chtMultiRegionSimpleFoam_novelocity in your run directory.
You can check also by only typing chtMultiRegionS and than tab to get an overview over all possibilities found. If everything is okay this should also show your new solver. |
|
January 14, 2020, 10:04 |
Energy only (no flow) in chtMultiRegionSimpleFoam
|
#18 |
Member
Join Date: Mar 2019
Posts: 81
Rep Power: 7 |
Hi Foamers,
I am facing the same problem. Currently am trying to simulate the same geometry several times with different inlet temperatures. The flow is converged and I want to change the inlet temperature. I was thinking of changing the under relaxation factor to zero for all the fields except for energy so that it is the only one being solved. Do you think this strategy would result in what I am seeking? Thanks |
|
January 24, 2020, 17:39 |
|
#19 | |
Member
Join Date: Mar 2019
Posts: 81
Rep Power: 7 |
Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
interpreting velocity field | asharma | OpenFOAM Post-Processing | 2 | October 9, 2010 02:19 |
Initial velocity field in StarCCM+ | Subhadeep | Siemens | 3 | December 21, 2008 04:40 |
Reconstruction of velocity and pressure field | Jianglan | Main CFD Forum | 0 | October 6, 2008 01:04 |
Initial Condition in 3D flows. | shekharc | Main CFD Forum | 9 | June 8, 2005 05:17 |
Using SIMPLE | david | Main CFD Forum | 5 | July 21, 1999 03:38 |