|
[Sponsors] |
writing a snippet for monitoring and saving components of a transport equation |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 19, 2016, 16:35 |
writing a snippet for monitoring and saving components of a transport equation
|
#1 |
Senior Member
Bobby
Join Date: Oct 2012
Location: Michigan
Posts: 454
Rep Power: 15 |
Dear Fellows
I have a transport equation in my solver as: Code:
surfaceScalarField rhoEFlux = -fvc::interpolate(sgm)*mesh.magSf()*fvc::snGrad(Ue); fvScalarMatrix rhoEEqn ( fvm::ddt(rhoE) + fvm::div(phi, rhoE) + fvc::div(rhoEFlux) - fvm::laplacian(kappa, rhoE) ); rhoEEqn.solve(); These line are added to createFields.H: Code:
volScalarField timeDerivative ( IOobject ( "timeDerivative", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), fvm::ddt(rhoE) ); volScalarField Convective ( IOobject ( "Convective", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), fvm::div(phi, rhoE) ); volScalarField Conductive ( IOobject ( "Conductive", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), -fvc::div(rhoEFlux) ); volScalarField Diffusive ( IOobject ( "Diffusive", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), fvm::laplacian(kappa, rhoE) ); Code:
timeDerivative = fvm::ddt(rhoE); Convective = fvm::div(phi, rhoE); Diffusive = fvm::laplacian(kappa, rhoE); Conductive = -fvc::div(rhoEFlux); Code:
/home/babak/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/GeometricField.C:1108:6: note: no known conversion for argument 1 from ‘Foam::tmp<Foam::fvMatrix<double> >’ to ‘const Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >&’ /home/babak/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/GeometricField.C:1144:6: note: void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=(const Foam::dimensioned<Type>&) [with Type = double; PatchField = Foam::fvPatchField; GeoMesh = Foam::volMesh] /home/babak/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/GeometricField.C:1144:6: note: no known conversion for argument 1 from ‘Foam::tmp<Foam::fvMatrix<double> >’ to ‘const Foam::dimensioned<double>&’ In file included from interFoamEHDFullChannelScrape.C:79:0: /home/babak/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/readTimeControls.H:38:8: warning: unused variable ‘maxDeltaT’ [-Wunused-variable] make: *** [Make/linux64GccDPOpt/interFoamEHDFullChannelScrape.o] Error 1 Regards |
|
December 19, 2016, 16:48 |
|
#2 |
Member
Arvind Jay
Join Date: Sep 2012
Posts: 96
Rep Power: 14 |
I have seen a similar error before.
Try using XXX.ref options to access the internal fields without the boundary patches. or the .value option. I may be completely wrong. Cheers |
|
December 19, 2016, 16:51 |
|
#3 |
Senior Member
Bobby
Join Date: Oct 2012
Location: Michigan
Posts: 454
Rep Power: 15 |
Dear Arvind
Thanks for your reply I want to avoid writing for internal fields, since it needs a lot of extra lines. About .value(), I thought of that, but these fields are volScalarFields, isn't it? AFA I know, .value() is for scalars not volScalarFields. Here, I just want to save and track a volScalarField which is used in the transport equation. Regards |
|
December 19, 2016, 17:25 |
|
#4 |
Senior Member
Bobby
Join Date: Oct 2012
Location: Michigan
Posts: 454
Rep Power: 15 |
I think my problem is due to defining terms implicitly in transport equation:
Code:
fvScalarMatrix rhoEEqn ( fvm::ddt(rhoE) + fvm::div(phi, rhoE) + fvc::div(rhoEFlux) - fvm::laplacian(kappa, rhoE) ); rhoEEqn.solve(); Since fvm:: is actually the implicit method and since the matrix of coeffiecients in the transport equation is coupled, you can not extract any term from it. However, you can easily reproduce and track each term of your transport equation separately, by simply using fvc:: which reprodues that term explicitly. Hope, these lines helped people with the same problem. Above snippet is correct, However, you need to replace fvm:: with fvc:: when defining volScalarFields in createFields.H file and updating variable at suitabe file inside the main section of code (My solver in electricEqn.H) Keep Foaming Fellows Last edited by babakflame; December 19, 2016 at 19:29. |
|
December 20, 2016, 10:35 |
Converting from one class to another
|
#5 |
Member
Arvind Jay
Join Date: Sep 2012
Posts: 96
Rep Power: 14 |
Note to myself:
Here is a brief description on some major data classes in OF (Ref):
|
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch | gschaider | OpenFOAM Installation | 225 | August 25, 2015 19:43 |