|
[Sponsors] |
How to define field in createFields.H fine in OF23x |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 15, 2015, 04:25 |
How to define field in createFields.H fine in OF23x
|
#1 |
Member
Gitesh
Join Date: Jan 2010
Location: Finland
Posts: 73
Rep Power: 16 |
Hello,
I am trying to define heat transfer coefficient in createFields.H file in twoPhaseEulerFoam solver of OF23x. Can any suggest how I can do that? Regrads, GP |
|
July 16, 2015, 07:37 |
|
#2 |
Senior Member
Join Date: Sep 2010
Posts: 226
Rep Power: 16 |
Hi,
Two methods: as a "dimensionedScalar" or as a "volScalarField" 1) First Method: in the file createField.H add: /////////////////////////////////////////////////// dimensionedScalar h ( transportProperties.lookup("h") ); /////////////////////////////////////////////////// and then you need to define its value with dimensions in the "transportProperties" file in the case/constant folder 2) sencond Method: in the file createField.H add: /////////////////////////////////////////////////// volScalarField h ( IOobject ( "h", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedScalar("h",dimensionSet(......),scalar( "your value")) ); /////////////////////////////////////////////////// Note that "NO_READ" must be changed to "MUSt_READ" based on your requirements. Don't Forget to recompile the solver with "wmake" command in terminal. Have Fun Regards, T.D. |
|
July 20, 2015, 04:22 |
|
#3 |
Member
Gitesh
Join Date: Jan 2010
Location: Finland
Posts: 73
Rep Power: 16 |
Hello,
Thank you very much for your help. Now I am able to print the fields what I want. Do you have any idea how I can get the total cell volumes where I have fluid interface? I mean in my case I need to calculate the total interracial area of interface. So need the cell volumes where the interface is there. Regards, GP |
|
December 24, 2020, 12:01 |
|
#4 |
New Member
Pratik
Join Date: May 2020
Location: Oldenburg, Germany
Posts: 14
Rep Power: 5 |
Hi,
I was trying the above-mentioned methods and they work. I get the file of the newly added field in the time steps folder but don't get the values in the timestep folders. It just shows the values that I mentioned in the 0 folder. for curiosity, I used Info statement to print the values of the newly added variable on-screen, and there it shows the expected values. but then why I am not getting them in timestep folders? |
|
December 7, 2023, 09:46 |
|
#5 | |
New Member
yingting tang
Join Date: Aug 2023
Posts: 7
Rep Power: 2 |
Quote:
volScalarField maxG ( IOobject ( "maxG", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), gradAlpha.max() ); when i run "wmake",the system display the following information: error:no matching function for call to 'Foam::GeometricField<double,Foam::fvPatchField,Fo am::volMesh>::max()' Does anyone know how to solve it? Thanks for any help!! |
||
December 7, 2023, 12:30 |
|
#6 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,685
Rep Power: 40 |
Quote:
Please take a look at the documentation: https://www.openfoam.com/documentati...tricField.html From there you will see that max() as a method clamps the field - it certainly doesn't return anything. Have you tried with max(gradAlpha) as a free function? I think this delivers the right thing, but since it is one of many, many max() functions it is not particularly easy to find in the documentation (unless you have an idea what you are looking for). |
||
December 8, 2023, 01:59 |
|
#7 | |
New Member
yingting tang
Join Date: Aug 2023
Posts: 7
Rep Power: 2 |
Quote:
For the problem I posed last night, I change my code into "scalar maxG=gMax(gradAlpha);" and then it can compile the solver sucessfully! |
||
December 8, 2023, 04:38 |
|
#8 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,685
Rep Power: 40 |
Quote:
You may still also want to have some dimensions (eg, m/s, 1/m etc) on your new quantity. In which case you would initialize with a dimensionedScalar. OpenFOAM has a lightweight dimension check for geometric fields - sometimes it is in the way, but most times it can help trace logic or programming errors when you put together equations. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
''unknown radialModelType type Gidaspow'' PROBLEM WITH THE BED TUTORIAL | AndoniBM | OpenFOAM Running, Solving & CFD | 2 | March 25, 2015 18:44 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 06:20 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 06:51 |
How do I define a custom vector field? | MHDWill | FLUENT | 0 | September 29, 2007 17:04 |
ACCESS VIOLATION | MHDWill | FLUENT | 1 | September 23, 2007 02:51 |