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

Editing chtMultiRegionFoam to not solve velocity field

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 6, 2011, 07:29
Default Editing chtMultiRegionFoam to not solve velocity field
  #1
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
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
tH3f0rC3 is offline   Reply With Quote

Old   April 7, 2011, 04:31
Default
  #2
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20
mvoss is on a distinguished road
Import the U-Filed with the
"NO_WRITE"-Option and comment out every u/p-related #include in the solver.
mvoss is offline   Reply With Quote

Old   April 7, 2011, 08:14
Default
  #3
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
Quote:
Originally Posted by neewbie View Post
Import the U-Filed with the
"NO_WRITE"-Option and comment out every u/p-related #include in the solver.
Hi thanks for the answer.
Sounds very easy.
Where can I change these settings?

Best Regards,
tH3f0rC3
tH3f0rC3 is offline   Reply With Quote

Old   April 7, 2011, 17:23
Default
  #4
Member
 
Sebastian Lang
Join Date: Aug 2009
Posts: 47
Rep Power: 16
sebonator is on a distinguished road
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
sebonator is offline   Reply With Quote

Old   April 11, 2011, 08:08
Default
  #5
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20
mvoss is on a distinguished road
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"));
    }
and then wrap the lines where to solve for "u" with
Code:
if(solveVel){
...
}
These lines will only be executed if there is an entry:
Code:
solveVel true;
in the dictionary named solveFor.

But you can do the same also for an existing dictionary in the cht-solver. Check the "../fluid/readFluidMultiRegionSIMPLEControls.H"

neewbie
mvoss is offline   Reply With Quote

Old   April 17, 2011, 08:48
Default
  #6
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
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
tH3f0rC3 is offline   Reply With Quote

Old   April 17, 2011, 12:43
Default
  #7
Member
 
Sebastian Lang
Join Date: Aug 2009
Posts: 47
Rep Power: 16
sebonator is on a distinguished road
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
sebonator is offline   Reply With Quote

Old   April 17, 2011, 13:02
Default
  #8
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
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:
Originally Posted by sebonator View Post
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
tH3f0rC3 is offline   Reply With Quote

Old   April 18, 2011, 04:29
Default
  #9
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
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:
Originally Posted by neewbie View Post
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"));
    }
and then wrap the lines where to solve for "u" with
Code:
if(solveVel){
...
}
These lines will only be executed if there is an entry:
Code:
solveVel true;
in the dictionary named solveFor.

But you can do the same also for an existing dictionary in the cht-solver. Check the "../fluid/readFluidMultiRegionSIMPLEControls.H"

neewbie
tH3f0rC3 is offline   Reply With Quote

Old   April 18, 2011, 04:55
Default
  #10
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20
mvoss is on a distinguished road
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;

// ******************************************************* //
Name it solveFor or whatever you like in the ../constant-folder.
Code:
IOdictionary solveFor //name
    (
        IOobject
        (
            "solveFor", //internalName in OF C++ Environment
            runTime.constant(),//where to search for
            mesh,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        )
    );
You have 3 kinds of names/objects:
  • the file in runtime.constant(),
  • the object "solveFor" and
  • the actual entry "solveVel" which is hold by the "solveFor"-IOobject.

Hopefully thatīs not totally rubbish in terms of C++-speech.
Please feel free to correct if not right.

neewbie
mvoss is offline   Reply With Quote

Old   April 18, 2011, 14:41
Default
  #11
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
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:
to solve for "u" you can delete/comment the appropriate lines in the solver source code
But where can I do that?

I also didn't get you at this point:
Quote:
You have 3 kinds of names/objects:
  • the file in runtime.constant(),
  • the object "solveFor" and
  • the actual entry "solveVel" which is hold by the "solveFor"-IOobject.
I will search for these files tomorrow in the source code of the solver. Maybe I will understand better than.
Are all the codes you pasted here for the solveFor-file?

Best Regards,
tH3f0rC3
tH3f0rC3 is offline   Reply With Quote

Old   April 19, 2011, 07:29
Default
  #12
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
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
tH3f0rC3 is offline   Reply With Quote

Old   April 19, 2011, 09:55
Default
  #13
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20
mvoss is on a distinguished road
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"
....
Honestly, what do you think could a happen if you donīt use a file called "solveFluid.H"? Thatīs kind-of obvious, isnīt it?

The real task is set in UEqn.H
Code:
eqnResidual=solve
(
...
).initialResidual()
and is wrapped with the residual-output, like you can see.

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
mvoss is offline   Reply With Quote

Old   April 20, 2011, 09:14
Default
  #14
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
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
tH3f0rC3 is offline   Reply With Quote

Old   April 20, 2011, 09:18
Default
  #15
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20
mvoss is on a distinguished road
Did you change the "files"-file EXE statement to point to FOAM_USER_APPBIN ? And also gave it a new name?
mvoss is offline   Reply With Quote

Old   April 20, 2011, 09:40
Default
  #16
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
Quote:
Originally Posted by neewbie View Post
Did you change the "files"-file EXE statement to point to FOAM_USER_APPBIN ? And also gave it a new name?
Yes, I have edited the files - file in the Make directory to:

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?
tH3f0rC3 is offline   Reply With Quote

Old   April 20, 2011, 10:53
Default
  #17
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20
mvoss is on a distinguished road
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.
mvoss is offline   Reply With Quote

Old   January 14, 2020, 09:04
Question Energy only (no flow) in chtMultiRegionSimpleFoam
  #18
Member
 
Join Date: Mar 2019
Posts: 81
Rep Power: 7
mm66 is on a distinguished road
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
mm66 is offline   Reply With Quote

Old   January 24, 2020, 16:39
Default
  #19
Member
 
Join Date: Mar 2019
Posts: 81
Rep Power: 7
mm66 is on a distinguished road
Quote:
Originally Posted by mm66 View Post
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
Any ideas/hints will be greatly appreciated
mm66 is offline   Reply With Quote

Reply


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
interpreting velocity field asharma OpenFOAM Post-Processing 2 October 9, 2010 01:19
Initial velocity field in StarCCM+ Subhadeep Siemens 3 December 21, 2008 03:40
Reconstruction of velocity and pressure field Jianglan Main CFD Forum 0 October 6, 2008 00:04
Initial Condition in 3D flows. shekharc Main CFD Forum 9 June 8, 2005 04:17
Using SIMPLE david Main CFD Forum 5 July 21, 1999 02:38


All times are GMT -4. The time now is 05:46.