Some minor new features: exported variables and derivatives

Numerical methods and mathematical models of Elmer
Post Reply
raback
Site Admin
Posts: 4832
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Some minor new features: exported variables and derivatives

Post by raback »

Hi All,

Related to some recent questions in Elmer forum there are now some new minor features open for testing. The features are featured in the attached example and are related to a svn commit 4294 (10 minutes ago).

Most importantly the values of exported variables may now be set similarly as the body-Dirichlet values of the primary variables. So if you decleare additional variables in a solver section you as in:

Code: Select all

  Exported Variable 1 = -dofs 1 TempRoot
  Exported Variable 2 = -dofs 2 TempPowers
  Exported Variable 3 = TempCut
  Nonlinear Update Exported Variables = Logical True
You may define their values in body force section as in:

Code: Select all

   TempRoot = Variable Temp
     Real MATC "sqrt(tx)"
   TempPowers 1 = Variable Temp
     Real MATC "tx*tx"
   TempPowers 2 = Variable Temp
     Real MATC "tx*tx*tx"
   TempCut = Equals Temp
   TempCut Condition = Variable Coordinate 1, Coordinate 2
     Real MATC "tx(0)-tx(1)"  
The body force section was chosen for compatibility with the old formalism even though it is not ideal conseptually. The feature must still be activated with the flag but could be made automatic.

Additonally it is possible to save the 1st and 2nd derivates related to a time-dependent equation solved with at least 2nd order integration schemes. Currently this just adds a new pointer for saving the results for the components of the PrevValues. For this purpose the variable type was modified to include a component "Secondary" which means that the variable ows its component to some other primary variable and should not be deallocated (this is only a concern to those who code, of course).

Code: Select all

  Calculate Velocity = Logical True
  Calculate Acceleration = Logical True
And finally there are some older related features that should be applicable to all equations that use the default solve sequence. The 1st one may be used to compute integration weights, the sum of which should of course be the volume/area. The 2nd one computes the nodal weights from the residual r=Ax-b needed to reproduce the solution, and the 3rd one just computed the energy norm of the FE problem, x^TAx/2.

Code: Select all

  Calculate Weights = Logical True
  Calculate Loads = Logical True
  Calculate Energy Norm = Logical True 
These are preliminary so all comments are welcome. All the tests still pass so I hope that this change did not break anything else...

-Peter
Attachments
angle.grd
Mesh definition file
(409 Bytes) Downloaded 225 times
TempDist.sif
Command file
(2.38 KiB) Downloaded 269 times
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Some minor new features: exported variables and derivatives

Post by mzenker »

For the records:

To define the value of an exported variable using a user defined function, the syntax is (in the body force section):

Code: Select all

TempRoot = Variable Temp
   Real Procedure "myfun.dll" "myfun"
Note the "Real" keyword which is necessary here!

Matthias
Post Reply