Hi Kumi, Jacq,


You might be able to achieve the equivalent of:


if(x>0)

    <your_expression>

else

    0


with:


 (x > 0) * <your_expression>



Best regards,
Stanisław Gepner, Ph.D.

Faculty of Power and Aeronautical Engineering
Nowowiejska 21/25 Str.
00-665 Warsaw, Poland
phone +48 (22) 234 51 70

On 27.06.2024 09:54, Xing, Jacques wrote:
Hi Kumi,

If by "logical operators", you mean if/else statements, I would say that this is probably a little bit too much to ask...

However, you maybe be able to get what you want by a clever use of min/max, floor/ceil, abs, sign, and tanh functions.

Cheers,
Jacques

From: Kumi Yasuda <kumi@polyta.pe>
Sent: 27 June 2024 07:47
To: Xing, Jacques <j.xing@imperial.ac.uk>
Cc: nektar-users <nektar-users@imperial.ac.uk>
Subject: Re: [Nektar-users] Forcing / momentum source for incompressible Navier-Stokes
 
Hi Jacques,

Thanks, I've managed to get similar forcing working now.

Is it possible to use conditional operators inside the FORMULA expressions?

Kind Regards,
Kumi


On Wed, Jun 26, 2024 at 04:15:15PM +0000, Xing, Jacques wrote:
> Hi Kumi,
>
> I can take a look at the manufacture solution example to see how you can specify a space-varying and time-dependant forcing term:
>
> https://gitlab.nektar.info/nektar/nektar/-/blob/master/solvers/IncNavierStokesSolver/Tests/manufactured_3DH1D.xml?ref_type=heads
>
> Cheers,
> Jacques
>
> ________________________________
> From: nektar-users-bounces@imperial.ac.uk <nektar-users-bounces@imperial.ac.uk> on behalf of Kumi Yasuda <kumi@polyta.pe>
> Sent: 26 June 2024 07:45
> To: nektar-users <nektar-users@imperial.ac.uk>
> Subject: [Nektar-users] Forcing / momentum source for incompressible Navier-Stokes
>
>
> *******************
> This email originates from outside Imperial. Do not click on links and attachments unless you recognise the sender.
> If you trust the sender, add them to your safe senders list https://spam.ic.ac.uk/SpamConsole/Senders.aspx to disable email stamping for this address.
> *******************
> Hi all,
>
> When using the incompressible Navier-Stokes solver, is it possible to add
> a force that is a function of spatial location, for example a localised
> "ideal fan" momentum source in a specific region?
>
> Could this force also be a function of time and/or of the momentum at a
> (different) given point or region?
>
> Kind Regards,
> Kumi
>
>
> _______________________________________________
> Nektar-users mailing list
> Nektar-users@imperial.ac.uk
> https://mailman.ic.ac.uk/mailman/listinfo/nektar-users

_______________________________________________
Nektar-users mailing list
Nektar-users@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/nektar-users