add2W and bcg auxcode

6 views
Skip to first unread message

Gary Sharpe

unread,
May 16, 2008, 8:37:43 AM5/16/08
to amrita-ebook
For EulerEquations or ReactiveEulerEquations
can one have more than one add2W statement,
i.e. is it possible to add more than one new variable to
the solution vector?
The example i have in mind is this,
currently I have something along the lines
ReactiveEulerEquations {
space=2D
add2W=PVORT
}
and I have a procedure which after n timesteps plots the PVORT field
e.g. with statements like
minmax W::PVORT[] -> minmax.
Now I want an additonal field, NVORT say so I tried
ReactiveEulerEquations {
space=2D
add2W=PVORT
add2W=NVORT
}
without any other changes to the code
and get:
expression 'W::PVORT[]' is undefined!

Line 13 is:
minmax W::PVORT[] -> min, max

error near:
W::PVORT[] -> min, max
I am assuming the problem may be it only
accepts the last add2W statement?

On a similar vein, can one have more than one
auxcode in BCG.
e.g. I currently have
BasicCodeGenerator {
scheme = roe'$znd::model
solver = 1step
auxcode = code/pvort_trace
}
where the code pvort_trace is the routine which
updates the W::PVORT variable field.
If I wanted to evaluate a 2nd variable field
(NVORT say) is it acceptable to daisy chain
a second piece of code
BasicCodeGenerator {
scheme = roe'$znd::model
solver = 1step
auxcode = code/pvort_trace
auxcode = code/nvort_trace
}
say, or does one of the auxcode statements
just overwrite the other?

Any advice from anyone who has looked at
this sort of thing before would be appreciated...

Best Wishes
Gary

James Quirk

unread,
May 16, 2008, 10:47:31 AM5/16/08
to Gary Sharpe, amrita-ebook
On Fri, 16 May 2008, Gary Sharpe wrote:

>
> For EulerEquations or ReactiveEulerEquations
> can one have more than one add2W statement,
> i.e. is it possible to add more than one new variable to
> the solution vector?
> The example i have in mind is this,
> currently I have something along the lines
> ReactiveEulerEquations {
> space=2D
> add2W=PVORT
> }
> and I have a procedure which after n timesteps plots the PVORT field
> e.g. with statements like
> minmax W::PVORT[] -> minmax.
> Now I want an additonal field, NVORT say so I tried
> ReactiveEulerEquations {
> space=2D
> add2W=PVORT
> add2W=NVORT
> }
> without any other changes to the code
> and get:
> expression 'W::PVORT[]' is undefined!

The above won't work as add2W is a procedure parameter
and so the second entry simply overwrites the first.
What you need to do is write:

ReactiveEulerEquations {
space = 2D
add2W = PVORT,NVORT
}

And if you take a look at:

$AMRITA/stdlib/equations/Add2W.amr

you'll see that it loops over the supplied parameter
adding named entries to the solution vector.

>
> On a similar vein, can one have more than one
> auxcode in BCG.
> e.g. I currently have
> BasicCodeGenerator {
> scheme = roe'$znd::model
> solver = 1step
> auxcode = code/pvort_trace
> }
> where the code pvort_trace is the routine which
> updates the W::PVORT variable field.
> If I wanted to evaluate a 2nd variable field
> (NVORT say) is it acceptable to daisy chain
> a second piece of code
> BasicCodeGenerator {
> scheme = roe'$znd::model
> solver = 1step
> auxcode = code/pvort_trace
> auxcode = code/nvort_trace
> }
> say, or does one of the auxcode statements
> just overwrite the other?

Again you could answer this question by delving into
the bowls of BCG. As before, the second auxcode
will overwrite the first. And if you take a look at:

$AMRITA/plugin/amr_sol/BCG/equations/ReactiveEulerEquations/AddAuxiliaryCode.amr

you'll see that it loops over supplied filenames and
so you could write:

BasicCodeGenerator {
scheme = roe'1a
solver = 1step
auxcode = code/pvort_trace,code/nvort_trace
}

James

Gary Sharpe

unread,
May 16, 2008, 12:24:39 PM5/16/08
to amrita-ebook
James,
ah, Isee...I assumed it was overwriting somehow. The correct way
to do it is, in hindsight, obvious.
> $AMRITA/stdlib/equations/Add2W.amr
> $AMRITA/plugin/amr_sol/BCG/equations/ReactiveEulerEquations/AddAuxiliaryCode.amr
Thank, thats useful to know where these are (again obvious from
directory structure).
Gary
Reply all
Reply to author
Forward
0 new messages