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

Solving with a variable non defined in 0 directory

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 7, 2015, 10:04
Question Solving with a variable non defined in 0 directory
  #1
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 12
kebsiali is on a distinguished road
Hello Foamers

Im trying to solve over a variable i call X which represents the ration of inital concentration Ci while i need the new C to be written at the end of each step

what i did is the following

1. in createFileds.H
volScalarField COH
(
IOobject
(
"COH",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

volScalarField XOH
(
IOobject
(
"XOH",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
(COH0-COH)/COH0
);


and then i create a .H file to solve for XOH as

fvScalarMatrix XOHEqn
(
fvm::ddt( XOH)
+ fvm::div(phi, XOH)
);

XOHEqn.solve();
COH=COH0*(1.0-XOH);


I thought it would work swiftly, but it shows an error i dont understand which is:

--> FOAM FATAL ERROR:

valueInternalCoeffs cannot be called for a calculatedFvPatchField
on patch atmosphere of field XOH in file "/home/alkebsi/OpenFOAM/alkebsi-2.3.1/run/heatingwater4/0/XOH"
You are probably trying to solve for a field with a default boundary condition.

From function calculatedFvPatchField<Type>::valueInternalCoeffs( const tmp<scalarField>&) const
in file /opt/openfoam231/src/finiteVolume/lnInclude/calculatedFvPatchField.C at line 154.

FOAM exiting

I dont have file called XOH in 0 directory, rather i have a file for COH in which all the boundaries are zeroGradient and i use a setFiled to partially fill the domain (I wrok with interFoam and my COH exists in one phase but this has nothing to do with the current problem)
kebsiali is offline   Reply With Quote

Old   April 7, 2015, 13:17
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 36
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

I guess boundary conditions for XOH should be the same as for COH. So you should use the following constructor for XOH:

Code:
volScalarField XOH
(
    IOobject
    (
        "XOH",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE
    ),
    (COH0-COH)/COH0,
    COH.boundaryField().types()
);
kebsiali likes this.
alexeym is offline   Reply With Quote

Old   April 8, 2015, 05:18
Default
  #3
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 12
kebsiali is on a distinguished road
Thank you very much
That was it, it worked.
kebsiali is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
High Courant Number @ icoFoam Artex85 OpenFOAM Running, Solving & CFD 11 February 16, 2017 13:40
simpleFoam error - "Floating point exception" mbcx4jc2 OpenFOAM Running, Solving & CFD 12 August 4, 2015 02:20
rhoSimplecFoam Mach0.8 no pressure values CFDnewbie147 OpenFOAM Running, Solving & CFD 16 November 23, 2013 05:58
pisoFoam with k-epsilon turb blows up - Some questions Heroic OpenFOAM Running, Solving & CFD 26 December 17, 2012 03:34
OpenFoam install script Error during paraFoam installation SePe OpenFOAM Installation 10 June 19, 2010 15:15


All times are GMT -4. The time now is 07:35.