UDF Error - undeclared(first use in this function)

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
Gen
Posts: 17
Joined: Sat Sep 05, 2020 7:39 am

UDF Error - undeclared(first use in this function)

Post by Gen »

Dear Code_Saturne team,
Bonjour!

I'm using version 7.1-alpha and I'm trying to modify SEM.

1) My simulation case is a simple turbulent channel flow, and it works well with the synthetic eddy method embedded in cs.
2) I chose to modify "cs_les_inflow.c" file and "cs_les_inflow.h" file. Then I put the new files in my case' SRC and in the base source file.
3)At first time, I tried to just make some minor changes on the original model, I added a new switch case and named it "AEM". So to test the feasibility(whether I successefully added a new case besides SEM, Batten, Random, etc), I copied the SEM content, only changed its name and keep the rest exactly the same as SEM.
4)Then I wrote "cs_user_les_inflow-base.c" and chose new CS_INFLOW method 'AEM'. But I got an error as below:
error: ‘CS_INFLOW_AEM’ undeclared (first use in this function); did you mean ‘CS_INFLOW_SEM’?
cs_les_inflow_add_inlet(CS_INFLOW_AEM,
^~~~~~~~~~~~~
CS_INFLOW_SEM
I thought I've made the declaration and I couldn't figure out how to correct it. I will be really grateful if you could kindly give me some advice.

Veuillez trouver les fichers dans la piece joint. Je vous remercie sincèrement!

Best regards,
Gen
Attachments
SEM_test.zip
(1.48 MiB) Downloaded 102 times
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: UDF Error - undeclared(first use in this function)

Post by Yvan Fournier »

Hello,

Modifying a .h file only in SRC may be a bit tricky, since only files in SRC use the new definition, others use the old one. So it is safer to really modify this in the code, and reinstall the full code.

If you only add an enum value at the end of a list, things should still work, so the erreor is still a bit surprising (I did not test it).

One simple solution may simply be to

#define CS_INFLOW_AEM (CS_INFLOW_SEM+1)

in your C code so you do not need the modified .h file in your user files. Again, if you have more significant modifications in the .h file, building a modified version of the code is best. As always, creating various local Git branches for your tests and merging /rebasing them when necessary is the best way of keeping your changes in sync with the code.

Best regards,

Yvan
Gen
Posts: 17
Joined: Sat Sep 05, 2020 7:39 am

Re: UDF Error - undeclared(first use in this function)

Post by Gen »

Hi,
The problem was solved successfully. Thank you sooooo much for your help! :)
Post Reply