AtChem/AtChem2

Adding a new variable to constrain

Opened this issue · 2 comments

Hi !
I've been trying to add a new variable to constrain. I'm looking into adding emissions as a constained file because a single value is not suitable for the tests I'm running as I nead weekly variability. On the one hand I thought about adding a new species (e.g EMICO), provide the constrains and parse the value into the desired species to be emitted like so:

% 1 : EMICO = CO ;

However, I don't think this is the best approach. The other option I could think of was to add the emission as an environmental constrain and use as:

% EMICO : CO = ;

To achieve this, I followed what is done for the BLHEIGHT trying to create a variable called EMICO, but I come across an error I can't debug, the model creates the mechanism.f90 file but fails to continue

model/configuration/mechanism.f90:10.132:

EC, BLHEIGHT, EMICO, DILUTE, JFAC, ROOFOPEN, J, RO2) bind(c,name='update_p'
1
Warning: Line truncated at (1)
model/configuration/mechanism.f90:10.132:

EC, BLHEIGHT, EMICO, DILUTE, JFAC, ROOFOPEN, J, RO2) bind(c,name='update_p'
1
Error: Missing closing paren for binding label at (1)
model/configuration/mechanism.f90:12.72:

    integer, parameter :: DP = selected_real_kind( p = 15, r = 307 )
                                                                    1

Error: Unexpected data declaration statement in CONTAINS section at (1)
model/configuration/mechanism.f90:13.54:

       real(c_double), intent(inout) :: p(:), q(:)
                                                  1

Error: Unexpected data declaration statement in CONTAINS section at (1)
model/configuration/mechanism.f90:14.119:`

Below the files I've modified (attached):

./build/mech_converter.py
./src/solverFunctions.f90
./src/constraintFunctions.f90
./src/inputFunctions.f90

I would appreciate any help you can provide, my knowledge in Fortran is very limited. Or if there is another way to add variable emissions.
4.Mod_code.zip

rs028 commented

@mpperezp I believe you are using an older version of AtChem2, can you please update to the latest version before doing modifications? Second, have a look at PR #432: in that pull request the code was modified to intriduce a new "constrainable" environment variable. You can use those modifications as a guideline. Hope this helps.

rs028 commented

@mpperezp did you manage to resolve this?