|
[Sponsors] |
February 22, 2013, 08:14 |
set directory for subMesh
|
#1 |
New Member
Fabian Wein
Join Date: Jan 2013
Posts: 13
Rep Power: 13 |
I am stucked and need help.
I create my subMesh as fvMeshSubset sm(mesh); sm.setCellSubset(sub); with the submesh I create volScalarField k_e and h_e What I actually need is the laplacian matrix fvMatrix<scalar> m = fvm::laplacian(k_e, h_2) But sm.subMesh().schemesDict() is empty and has no laplacianSchemes. I did not find how to add the schemes file: keyword laplacian(k,h) is undefined in dictionary ".../system/region0SubSet/fvSchemes::laplacianSchemes" And I was also not able to set i programatically as sm.subMesh().schemesDict() ist const. How can I set my laplacian schemes for my subMesh? |
|
February 22, 2013, 08:18 |
|
#2 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37 |
Hi Fabian
Merely make a folder called system/region0SubSet and create an fvSolution and fvScheme file in this directory. OpenFoam will automatically find these files and use them in a way identical to the basic fvSolution and fvScheme files. Kind regards, Niels |
|
February 22, 2013, 08:22 |
|
#3 |
New Member
Fabian Wein
Join Date: Jan 2013
Posts: 13
Rep Power: 13 |
Thanks four your reply Niels.
It does not work. When I do sm.setLargeCellSubset(sub, -1, false) instead of sm.setCellSubset(sub); the name is not changed (also commented in fvMeshSubset.C) but the directory is also empty. Do I miss something? Do I need to activate reading from the directory? |
|
February 22, 2013, 09:05 |
|
#4 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37 |
Hi Fabian,
I went into my code to see my steps: 1. This is how I create the subMesh: Code:
// Creates a fvMeshSubset (Construction done differently in 1.6 and onwards) submesh_ = new fvMeshSubset(cGlobal_, mesh_); // Set the cell labels to be used in cMesh. (cellSet, label, bool) submesh_->setLargeCellSubset(suspendedCells, suspPatchID_, true); // Write cMesh - write all information! submesh_->subMesh().setInstance( mesh_.time().constant() ); submesh_->subMesh().write(); // Make sure that only the points are written to the disk submesh_->subMesh().setInstance( mesh_.time().timeName() ); submesh_->subMesh().setTopoWriteOpt(IOobject::NO_WRITE); Code:
inline const fvMesh & cMesh() const { return submesh_->subMesh(); }; Code:
volScalarField k ( IOobject ( "k", mesh_.time().timeName(), cMesh(), IOobject::MUST_READ, IOobject::AUTO_WRITE ), cMesh() ); Niels |
|
February 22, 2013, 09:28 |
|
#5 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37 |
P.S. This works in 1.6-ext.
/ Niels |
|
February 22, 2013, 11:21 |
|
#6 |
New Member
Fabian Wein
Join Date: Jan 2013
Posts: 13
Rep Power: 13 |
I have 2.1.1, this might be the problem. The files exist, but as my dictionary is empty it might be the case that it is not read
I found that the vectors are only properly read when their name in their header are ok. I tried to play a little bit with the location. How can I activate debug output? I have problems debugging my code, one day it works (complete OpenFoam build in debug version) the other day it does not work with gdb (Linux) |
|
February 22, 2013, 16:12 |
|
#7 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37 |
Well, if the files do exist, then what happens if you define how to compute the Laplacian? As I understand it, you have not defined the discretisation in system/region0SubSet/fvSchemes?
I have no experience with GDB, thus I cannot help you in that regard. Have a nice weekend, Niels |
|
February 25, 2013, 06:14 |
|
#8 | |
New Member
Fabian Wein
Join Date: Jan 2013
Posts: 13
Rep Power: 13 |
Quote:
I tried also with adding region0SubSet to location or object in these files. sm.subMesh().schemesDict().size() is always empty. Any more hints? It might be something stupid, e.g. like setting the wrong entries in the location field in the files or some other file needs to be present in region0SubSet, ...? |
||
February 27, 2013, 04:47 |
|
#9 |
New Member
Fabian Wein
Join Date: Jan 2013
Posts: 13
Rep Power: 13 |
The submesh definetly does not try to read the scheme. I checked with strace the system calls and see all file operations.
I also cannot call dynamic_cast<fvSchemes&>(sm.subMesh()).read() as the readOpt is set to READ_ONLY and I did not find, who it can be changed. Meanwhile I'm sure this is a bug in OpenFOAM 2.1.1 This is the laplacian method in question: laplacian ( const GeometricField<GType, fvPatchField, volMesh>& gamma, const GeometricField<Type, fvPatchField, volMesh>& vf, const word& name ) { return fv::laplacianScheme<Type, GType>::New ( vf.mesh(), vf.mesh().laplacianScheme(name) )().fvmLaplacian(gamma, vf); } I add a own implementation where I can provide the laplacianScheme of the system mesh laplacian ( const GeometricField<GType, fvPatchField, volMesh>& gamma, const GeometricField<Type, fvPatchField, volMesh>& vf, const word& name, ITstream& scheme ) { return fv::laplacianScheme<Type, GType>::New ( vf.mesh(), scheme )().fvmLaplacian(gamma, vf); } |
|
February 27, 2013, 04:49 |
|
#10 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37 |
Hi Fabian,
It is good that you found a work-around. Please report the issue in the OpenCFD's bug-tracker. Kind regards Niels |
|
April 24, 2014, 10:28 |
Other solution
|
#11 |
New Member
Jacques F.
Join Date: Jul 2013
Location: Toulouse
Posts: 6
Rep Power: 13 |
As fvMesh Objects are indeed construct with the NO_READ IOObject option, it do not read fvSchemes nor fvSolution dict neither for subMesh constructed from setCellSubSet() method (and looking for a system/region0SubSet as instance dir.) nor for setLargeCellSubSet(), which keeps the parent mesh system directory.
A solution, which seems to work, is to set the subMesh read option on MUST_READ manually via: Code:
subMesh.fvSchemes::readOpt() = parentMesh.fvSchemes::readOpt(); subMesh.fvSolution::readOpt() = parentMesh.fvSolution::readOpt(); Code:
subMesh.fvSchemes::read(); subMesh.fvSolution::read(); Best regards, |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM.org] unable to source openFOAM under $HOME directory | lilinghan8 | OpenFOAM Installation | 15 | October 15, 2019 03:53 |
[CGNS] CGNS converters available | mbeaudoin | OpenFOAM Meshing & Mesh Conversion | 137 | December 14, 2018 05:20 |
Problem installing on Ubuntu 9.10 -> 'Cannot open : No such file or directory' | mfiandor | OpenFOAM Installation | 2 | January 25, 2010 10:50 |
Compiling OpenFOAM13 on AMD64 with Redhat Enterprise | mbeaudoin | OpenFOAM Installation | 20 | June 17, 2008 07:43 |
Env variable not set | gruber2 | OpenFOAM Installation | 5 | December 30, 2005 05:27 |