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

Take fields from another folder

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 26, 2021, 16:23
Default Take fields from another folder
  #1
New Member
 
Join Date: Jul 2021
Posts: 4
Rep Power: 4
Mnuk is on a distinguished road
Hello to everyone!

I created a new solver and many volScalarFields are involved. In order to be clearer in the case to be simulated, I store them in different folders in 0 so:

0/Amplitudes
0/Fluxes
0/Properties
0/Weights

No problems, just change in createFields.H where I take variables like:

volScalarField fi1
(
IOobject
(
"Fluxes/fi1",
runTime.timeName(),
mesh_fi,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh_fi
);

However when I run the solver it gives me a problem: the fvSchemes is not able to find the variables!
It should do:

fvm::laplacian(DD1,fi1)

while in fvSchemes there is:

laplacian(DD1,fi1) Gauss linear corrected;

but it gives me this error:

Entry 'laplacian(Properties/DD1,Fluxes/fi1)' not found in dictionary "/mnt/c/users/hp/desktop/tesi/calcoli/Space_energy/RI1/system/fvSchemes.laplacianSchemes"

So I ask you: how to solve this? Is it possible to do what I want, so store the variables in subfolders in 0? Thanks to everyone
Mnuk is offline   Reply With Quote

Old   December 28, 2021, 09:45
Default
  #2
Member
 
MNM
Join Date: Aug 2017
Posts: 69
Rep Power: 8
SHUBHAM9595 is on a distinguished road
Hi Mnuk, what you are trying to do is possible. We just need to provide "consistent" naming conventions for the defined field variables.


1. A quick workaround should be to replace
Code:
laplacian(DD1,fi1) Gauss linear corrected;
with
Code:
laplacian(Properties/DD1,Fluxes/fi1) Gauss linear corrected;
Few remarks
2. I dont know why u r using multiple names to define the variable. Either fluxes or fi1 should do the job.
3. No idea about which specific constructor u r using but there is no need to use mesh_fi as all field variables are defined for a single common grid (which is just- mesh). You can also confirm this by looking at any createFields file.
SHUBHAM9595 is offline   Reply With Quote

Old   January 2, 2022, 17:52
Default
  #3
New Member
 
Join Date: Jul 2021
Posts: 4
Rep Power: 4
Mnuk is on a distinguished road
Hi Shunbam, thanks a lot for your answer!

I tried to do what you are suggesting in first bullet but it doesn't work because the "/" in "Fluxes/fi1" creates some problems.

Wrong token type - expected word, found on line 45: punctuation '/'

I come to an half solution. As it can be red from IOobject.H, at lines 250 and so on (https://www.openfoam.com/documentati...8H_source.html) there is the possibility to name the variable (in my case fi1) and below write the path where it is located, like:

volScalarField fi1
(
IOobject
(
"fi1",
runTime.timeName(),
"/Fluxes",
mesh_fi,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh_fi
);


where "fi1" is the name of the variable and "/Fluxes" the subfolder. This is below runTime.timeName() in such a way that the complete path is:

C:\folder\folder\folder\Case_study\0\Fluxes\fi1

where in "Case_study" are located also system and constant.

In this way there are no more problems with fvSchemes and fvSolution but when code saves variables it does it in subfolders in times folders like:

C:\folder\folder\folder\Case_study\0.002\Fluxes\fi 1

which can not be red by Paraview.

So now my question is how to save the variables in times folders and not in subfolders.

For the other two bullets:

2. Fluxes is the subfolder that contains fi1.
3. I am using two meshes so I need mesh and mesh_fi.


I wish to you an happy new year
Mnuk is offline   Reply With Quote

Reply

Tags
folder, fvschemes


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
Postprocess: sampleDict works but creates no output folder shock77 OpenFOAM Post-Processing 14 November 15, 2021 08:27
Сhoice fields using mapFields Reptider OpenFOAM Running, Solving & CFD 0 July 13, 2021 11:44
write fields in openfoam database in boundary patch medmast OpenFOAM Programming & Development 7 February 14, 2017 15:53
Is there a way to write only the probe locations instead the whole fields? jeanbvb OpenFOAM Programming & Development 6 October 5, 2016 10:57
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 18:57


All times are GMT -4. The time now is 01:09.