CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Time and Variable Dependent boundary conditions. (https://www.cfd-online.com/Forums/openfoam-solving/104793-time-variable-dependent-boundary-conditions.html)

alvora July 16, 2012 09:42

Time and Variable Dependent boundary conditions.
 
Hello everyones,

I want to implement new boundary conditions for electrohydrodynamics flow..
There is a conductive plate which is immersed in unipolar charge flow..
I want boundary condition as below on conductive plate surface..

d(Voltage)/dn=(chargeDensity)/epsilon,

where, voltage and charge density are variables parameter and epsilon is constant dimension scalar..
d/dn is normal gradient to surface..
for voltage and charge density, equations are separate.. But, voltage boundary condition on plate surface is depended on charge density...

Can any one tell me that How I can implement?

Thanx in advance

alpesh

gschaider July 16, 2012 12:36

Quote:

Originally Posted by alvora (Post 371638)
Hello everyones,

I want to implement new boundary conditions for electrohydrodynamics flow..
There is a conductive plate which is immersed in unipolar charge flow..
I want boundary condition as below on conductive plate surface..

d(Voltage)/dn=(chargeDensity)/epsilon,

where, voltage and charge density are variables parameter and epsilon is constant dimension scalar..
d/dn is normal gradient to surface..
for voltage and charge density, equations are separate.. But, voltage boundary condition on plate surface is depended on charge density...

Can any one tell me that How I can implement?

Thanx in advance

alpesh

If the chargeDensity does not change you can do it with fixedGradient. Otherwise I'd (but that is me) use groovyBC with fractionExpression "0" and a gradientExpression

alvora July 16, 2012 17:32

Hello Bernhard Gschaider,

Thank you very much for reply..

In my case, chargeDensity is also changing with time... I thought to do with groovyBC.. but I dont know how to do in openfoam210.. n moreover I don't know how to implement normal gradient in groovyBC. Because, New voltage surface gradient is equal to chargeDensity/epsilon.. I dont know what to do with d/dn?
Can I consider as new voltage on boundary patch is equal to new_chargeDensity/(epsilon*patch.deltaCoeffs()) ?

Kind Regards
Alpesh

alvora July 16, 2012 17:41

Hello Bernhard Gschaider,

I also tried with this way.. but don't know that is it correct or not?
I put below code in one header file and make link with source file in time loop..

label phifreePatchID = mesh.boundaryMesh().findPatchID("phifreeplate");
//label patchId=patch().boundaryMesh().lookupPatchID(patch Name);

fvPatchScalarField& rho_CD = rhoCharge.boundaryField()[phifreePatchID];
fvPatchScalarField& platevoltage = voltage.boundaryField()[phifreePatchID];

const fvsPatchVectorField& centre = mesh.Cf().boundaryField()[phifreePatchID];
const fvsPatchVectorField& normal = mesh.Sf().boundaryField()[phifreePatchID];
//const surfaceScalarField& delta = mesh.boundaryMesh()[phifreePatchID].snGrad();
const polyPatch& cPatch = mesh.boundaryMesh()[phifreePatchID];

scalar patchArea = 0.0;
scalar r_charge =0.0;
forAll(cPatch, faceI)
{
patchArea += mesh.magSf().boundaryField()[phifreePatchID][faceI];
r_charge += rhoCharge.boundaryField()[phifreePatchID][faceI];
}

forAll (platevoltage, faceI)
{
platevoltage[faceI]= r_charge/(patchArea);
}

I wrote last equations as:
forAll (platevoltage, faceI)
{
platevoltage[faceI]= r_charge/(epsilon0*patchArea*mesh.boundaryMesh()[phifreePatchID].snGrad());
}
and instead of snGrad, I also used .deltaCoeffs(), but I got error in both case..

Can you tell me that this type of way is correct or not? and what mistake I am doing in code?

Thank in advance
kind Regards
Alpesh

gschaider July 17, 2012 18:49

Quote:

Originally Posted by alvora (Post 371738)
Hello Bernhard Gschaider,

Thank you very much for reply..

In my case, chargeDensity is also changing with time... I thought to do with groovyBC.. but I dont know how to do in openfoam210.. n moreover I don't know how to implement normal gradient in groovyBC. Because, New voltage surface gradient is equal to chargeDensity/epsilon.. I dont know what to do with d/dn?
Can I consider as new voltage on boundary patch is equal to new_chargeDensity/(epsilon*patch.deltaCoeffs()) ?

Kind Regards
Alpesh

Normal gradient in groovyBC: that's what I explained in the other posting: set fractionExpression to 0 and you have a pure fixedGradient condition (see definition of the mixed-BC).

d/dn: fixedGradient is always defined in the normal direction of the patch. So you already have that

alvora July 18, 2012 06:26

Hi Bernhard Gschaider,

Thank you very much for reply,
I implemented as below:

phifreeplate
{
type groovyBC;
gradientExpression "(rhoCharge/epsilon)";
variables "rhoCharge@phifreeplate=sum(rhoCharge*mag(Sf() ))/sum(mag(Sf()));epsilon=8.8541e-12;";
value uniform 0;
fractionExpression "0";
}

Can you tell me that is this correct or not, please?

Kind Regards
Alpesh VORA

gschaider July 18, 2012 10:02

Quote:

Originally Posted by alvora (Post 372101)
Hi Bernhard Gschaider,

Thank you very much for reply,
I implemented as below:

phifreeplate
{
type groovyBC;
gradientExpression "(rhoCharge/epsilon)";
variables "rhoCharge@phifreeplate=sum(rhoCharge*mag(Sf() ))/sum(mag(Sf()));epsilon=8.8541e-12;";
value uniform 0;
fractionExpression "0";
}

Can you tell me that is this correct or not, please?

Kind Regards
Alpesh VORA

You're calculating a local variable rhoCharge (BTW: you can omit the @phifreeplate) that is the weighted average of a field rhoCharge. Is that what you want?

From what I understand you might want to skip that variable altogether (variables "epsilon=8.8541e-12;";) to get an inhomogenous gradient

alvora July 19, 2012 09:15

Quote:

Originally Posted by gschaider (Post 372156)
You're calculating a local variable rhoCharge (BTW: you can omit the @phifreeplate) that is the weighted average of a field rhoCharge. Is that what you want?

From what I understand you might want to skip that variable altogether (variables "epsilon=8.8541e-12;";) to get an inhomogenous gradient


Yes, I need average chargeDensity of only phifreeplates. I mean, a total charge which deposited on phifreeplate divide by total area of phifree plate..

question is: does above BC only calculating charge on phifree plate or whole domain?

Can you tell me last thing again, please? i didn't get why I should have to skip epsilon variable, please?

Kind Regards
A

gschaider July 19, 2012 20:29

Quote:

Originally Posted by alvora (Post 372385)
Yes, I need average chargeDensity of only phifreeplates. I mean, a total charge which deposited on phifreeplate divide by total area of phifree plate..

question is: does above BC only calculating charge on phifree plate or whole domain?

Can you tell me last thing again, please? i didn't get why I should have to skip epsilon variable, please?

Kind Regards
A

If I get your verbal explanation right, then your original formula is right. Although I'm not convinced that it makes sense physically: because I think that the d/dn on each face of the patch depends on the amount of charge on that face (and not on the others . in extreme: one face has all the charges and the others have none: then the solution would be different than from the case where you average the charge onto all the other faces: which is what you're proposing)

In short: groovyBC/swak take no responsibility that you got the physics right. That's on you


All times are GMT -4. The time now is 05:19.