|
[Sponsors] | |||||
|
|
|
#1 | ||
|
New Member
Join Date: Nov 2016
Posts: 16
Rep Power: 11 ![]() |
Dear All,
I'm implementing a new particle force with two input parameters. And I want these two parameters can be read from input file (/constant), then I do not need to compile for every runs. The way I did as following: Quote:
Quote:
Greetings, ycui |
|||
|
|
|
|||
|
|
|
#2 |
|
Senior Member
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 22 ![]() |
(Please use code-tags, not quote-tags for code.)
The error is quite clear: the variables 'runTime' and 'mesh' do not exist at the position where you inserted your code. So where exactly did you insert this piece of code? |
|
|
|
|
|
|
|
|
#3 | |
|
New Member
Join Date: Nov 2016
Posts: 16
Rep Power: 11 ![]() |
Quote:
I try to use this->mesh().time() and this->mesh(), but doesn't works. |
||
|
|
|
||
|
|
|
#4 |
|
Senior Member
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 22 ![]() |
The mesh and runTime variables are part of the solver. The thing you are changing is a library used by the solver - but it has no knowledge of what is going on inside your solver. It is just doing its own thing.
To find out how to do this, use search commands: Code:
cd ${FOAM_SRC}/lagrangian/intermediate/submodels/Kinematic/ParticleForces/
grep -rn "IOobject" .
Code:
cd ${FOAM_SRC}/lagrangian/intermediate/submodels/Kinematic/
grep -rn "IOobject" .
Code:
vi ./PatchInteractionModel/LocalInteraction/LocalInteraction.C +122 Code:
template<class CloudType>
Foam::volScalarField& Foam::LocalInteraction<CloudType>::massEscape()
{
if (!massEscapePtr_.valid())
{
const fvMesh& mesh = this->owner().mesh();
massEscapePtr_.reset
(
new volScalarField
(
IOobject
(
this->owner().name() + ":massEscape",
mesh.time().timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimMass, 0.0)
)
);
}
return massEscapePtr_();
}
|
|
|
|
|
|
|
|
|
#5 | |
|
New Member
Join Date: Nov 2016
Posts: 16
Rep Power: 11 ![]() |
Dear floquation,
Thank you very much for the answer. I found a simple way to do this, just add Quote:
However, your method would be very helpful when one reads a time dependent parameter. Thank you again, Best regards, ycui |
||
|
|
|
||
|
|
|
#6 |
|
New Member
Shuai Yuan
Join Date: Nov 2016
Posts: 29
Rep Power: 11 ![]() |
Hey,
Can you help me to implement a new force to OpenFOAM? I really appreciate it. Thank you in advance. |
|
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [PyFoam] and paraview | eelcovv | OpenFOAM Community Contributions | 28 | May 30, 2016 10:23 |
| particles leave domain | Steffen595 | CFX | 9 | March 7, 2016 17:19 |
| About the dimension of Saffman-Mei particle lift force model | haakon | OpenFOAM Programming & Development | 1 | April 22, 2013 13:27 |
| model particle movement under magnetic force | phsieh2005 | Main CFD Forum | 8 | March 28, 2007 08:12 |
| Setting particle parameters | Mark | FLUENT | 0 | April 22, 2004 13:13 |