|
[Sponsors] |
Trying to integrate using snGrad(). Need some help |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 18, 2013, 12:12 |
Trying to integrate using snGrad(). Need some help
|
#1 |
New Member
Terry
Join Date: May 2013
Posts: 9
Rep Power: 12 |
I am in desperate need of some help with a bit of code I'm trying to implement. I know what I need to do but so far I've been unable to code it properly! I've been struggling with this for almost 3 weeks now to no avail!!
So, here's my problem. I'm trying to find the corona current surrounding a wire in a duct. To do this I need to integrate over the surface of the wire. Inside of this integral I also need the surface normal vector of the E-field. Here's the code I have so far: Code:
60 volVectorField E("E",-fvc::grad(phi)); //Solve For E-Field// 61 62 //Calculating the Corona Current 63 64 label patchID = mesh.boundaryMesh().findPatchID("wire"); 65 const polyPatch& cPatch = mesh.boundaryMesh()[patchID]; 66 const surfaceScalarField dl = mesh.magSf(); 67 68 scalar coronaI = 0.0; 69 forAll (cPatch, i) 70 { 71 coronaI += -rho*k*snGrad(E)[i]*dl.boundaryField()[patchID][i]; 72 } Code:
Tester.C:71:44: error: no match for ‘operator[]’ in ‘Foam::fvc::snGrad(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) [with Type = Foam::Vector<double>]()[i]’ This is a 2D problem by the way. So the magSf() should return my differential length of each cell. Any help is very appreciated and much needed!! Last edited by MechBoom; November 18, 2013 at 18:26. Reason: more info |
|
November 18, 2013, 15:50 |
Trying to integrate using snGrad(). Need some help
|
#2 |
Senior Member
|
Dear Terry,
1.) Could you please try to change the name of your thread to something more narrative about the problem? Ideally what solver you are modifying? Unfortunately by now many people ignore threads of which the name doesn't clearly state the problem. 2.) Could you please attach the error logs you received concerning the compilation of the code? "wmake code.C &> log.error" should do the trick... 3.) Unfortunately I do not know the coding in OF well enough for such questions... Regards, Bernhard |
|
November 18, 2013, 18:19 |
|
#3 |
New Member
Terry
Join Date: May 2013
Posts: 9
Rep Power: 12 |
Bernhard,
Thanks for your help, I've edited the post but I can't seem to change the visible title in the forum, so I just started a new thread. Hopefully, that's ok. I don't want to clog up the forum with uneeded posts! |
|
November 19, 2013, 18:01 |
|
#4 | ||
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
Greetings to all!
@MechBoom: Quote:
Quote:
As for the original question, a few quick suggestions:
Bruno
__________________
|
|||
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
advanced function with snGrad | Ingenierias2003 | OpenFOAM | 0 | July 21, 2011 10:29 |
the integrate filter paraView | bruxellois | OpenFOAM | 0 | October 3, 2010 19:08 |
[OpenFOAM] Integrate Variables using PAraFoam | nandiganavishal | ParaView | 2 | April 17, 2009 13:38 |
how to integrate the velocity profile | Dejara | Siemens | 3 | June 26, 2006 01:34 |