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

class element problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 4, 2017, 11:04
Default class element problem
  #1
New Member
 
Antonio Suma
Join Date: Sep 2017
Posts: 2
Rep Power: 0
nellosamr is on a distinguished road
Dear all,
I've a problem with the implementation of an equation caused by incompatibility between different classes.
I've to calculate a coefficient which is function of the magnitude of a geometric field vector (E). The resolution dependes from a comparison with a reference value, as shown down.

Code:
4.71x10^(-11)*|E/p|^3        for |E/p|<referenceValue
3.32(|E/p|-12500)^0.5        for |E/p|>referenceValue
referenceValue=1.4x10^4
My problem is that I can't compare the |E/p| with a reference value. I've tryed to give the reference value as a volScalarField, but it results that the ">" can be used only with scalars, I've tryed to write also max(mag(E/p),mag(referenceValue))operator==mag(referenceValu e), but it seems that this instruction work only with bool. Also (mag(electricField/p).)value() doesn't work.
I don't know how to proceed.
Thank you in advance for your help.
Best Regards,
Antonio
nellosamr is offline   Reply With Quote

Old   September 10, 2017, 17:16
Default
  #2
New Member
 
ANKUR GARG
Join Date: Mar 2017
Posts: 23
Rep Power: 9
ankur_garg is on a distinguished road
Hi nellosamr,


First, I want to understand your problem clearly. The Coefficient which you want to calculate is Scalar? And Geometric Field vector is a vector quantity? And what is p here?


Thank you very much.

Regards,
Ankur
ankur_garg is offline   Reply With Quote

Old   September 11, 2017, 03:01
Default
  #3
Member
 
Pierre HORGUE
Join Date: May 2009
Posts: 33
Rep Power: 17
Pedro24 is on a distinguished road
Hi nellosamr,

If referenceValue is a scalar, you can do a loop over the cell like that :

Code:
forAll(mesh.C(),celli)
{
if ((E[celli]/p[celli]) < referenceValue)
{
newField[celli] = something(E[celli]/p[celli];
}
else
{
// do 2
}
}
you sould make the same over the patches if necessary.

Sincerely,

Pierre
Pedro24 is offline   Reply With Quote

Old   September 11, 2017, 06:42
Default
  #4
New Member
 
Antonio Suma
Join Date: Sep 2017
Posts: 2
Rep Power: 0
nellosamr is on a distinguished road
Thank you both in advance for your answer.

Quote:
Originally Posted by ankur_garg View Post
Hi nellosamr,


First, I want to understand your problem clearly. The Coefficient which you want to calculate is Scalar? And Geometric Field vector is a vector quantity? And what is p here?


Thank you very much.

Regards,
Ankur

The coefficient is a dimensionedScalar. The geometricField E is a vector quantity, while the pressure p is a volScalarField.


Quote:
Originally Posted by Pedro24 View Post
Hi nellosamr,

If referenceValue is a scalar, you can do a loop over the cell like that :

Code:
forAll(mesh.C(),celli)
{
if ((E[celli]/p[celli]) < referenceValue)
{
newField[celli] = something(E[celli]/p[celli];
}
else
{
// do 2
}
}
you sould make the same over the patches if necessary.

Sincerely,

Pierre
Ok, I've tried it and it compiles. Now, I've to fix some other features, and then I will try to launch the solver on a well-known test case.
Thank you again for your attention and courtesy.
Best regards,
Antonio
nellosamr is offline   Reply With Quote

Reply

Tags
class, comparison, geometricfield


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
mesh file for flow over a circular cylinder Ardalan Main CFD Forum 7 December 15, 2020 13:06
Unit's problem with Finite Element Modeler Carlos Modesto ANSYS 0 August 28, 2017 10:46
[ANSYS Meshing] Problem with specifying first element size in 2D Mesh sigmundab ANSYS Meshing & Geometry 9 April 14, 2016 09:53
Can you help me with a problem in ansys static structural solver? sourabh.porwal Structural Mechanics 0 March 27, 2016 17:07
Problem with Remeshing element az_f ANSYS Meshing & Geometry 1 July 29, 2010 09:27


All times are GMT -4. The time now is 08:38.